NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page JavaScript Expand/Collapse

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 01-29-2005, 07:33 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
Jamison54's Avatar
Join Date: Jan 2005
Location: Milwaukee, WI
Posts: 305
Jamison54 will become famous soon enoughJamison54 will become famous soon enough
 



JavaScript Expand/Collapse


Hi all!

If your in need of a simple script to have an expandable/collapsable menu, use my script:
????: NamePros.com http://www.namepros.com/code/67426-javascript-expand-collapse.html
HTML Code:
<script langauge="JavaScript" type="text/javascript">
function doMenu(item) {
 obj=document.getElementById(item);
 col=document.getElementById("x" + item);
 if (obj.style.display=="none") {
  obj.style.display="block";
  col.innerHTML="[-]";
 }
 else {
  obj.style.display="none";
  col.innerHTML="[+]";
 }
}
</script>
Then just layout a simple div:
HTML Code:
<a href="JavaScript:doMenu('main');" id=xmain>[+]</a> Main Item
<div id=main style="margin-left:1em">
 <a href=#>Item 1</a><br>
 <a href=#>Item 2</a><br>
 <a href=#>Item 3</a>
</div>
<br>
This should work in Internet Explorer 4.x+ and Firefox but you'll have to do a few checks to make it Netscape compatiable (which im not gonna explain).
Jamison54 is offline  
Old 06-29-2005, 12:57 AM   #2 (permalink)
Account Closed
Join Date: May 2005
Location: NY, USA
Posts: 283
hasif has a spectacular aura abouthasif has a spectacular aura about
 



i was looking for this for my download zone website, i will use it as microsoft download senter used.
hasif is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 01:58 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger