PilotCart Support Forum
PilotCart Support Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snippets
 JavaScript
 Toggle a span (hide show a span or div)
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic Next Topic  

zwemkec
Moderator

USA
713 Posts

Posted - 02/20/2008 :  1:50:57 PM  Show Profile  Visit zwemkec's Homepage  Reply with Quote
Put this in your .js file, or in the header of the document.
<!--- SCRIPT --->
<script>
function showhideCPDiv(theItem) {
	if (typeof(theItem) != "undefined") {
		if (document.getElementById(theItem).style.display == 'none') {
			document.getElementById(theItem).style.display = 'block'; }
		else {
			document.getElementById(theItem).style.display = 'none'; }
		}}
</script>


this will make the span that will open and close, along with a link on top of it that will control the toggling.
<!--- HTML --->

<!-- Starts closed-->
<br><a href="javascript:void(0)" OnClick="showhideCPDiv('AuditListing')">Click To Toggle Order Audit</a><br>
<span id="AuditListing" style="display:none;">
	Hi.  I am text.
</span>


<!--- ALERTNATE HTML --->

<!-- Starts open-->
<br><a href="javascript:void(0)" OnClick="showhideCPDiv('AuditListing')">Click To Toggle Order Audit</a><br>
<span id="AuditListing" style="display:block;">
	Hi.  I am text.
</span>


<%
Chris Zwemke
chris @ scarabmedia . com
www.pilotcart.com
%>
   Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
PilotCart Support Forum © 2008 Spliethof Inc dba PilotCart.com Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.06