JavaScript Expand/Collapse

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

Jamison54

Established Member
Impact
2
Hi all!

If your in need of a simple script to have an expandable/collapsable menu, use my script:
HTML:
<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:
<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).
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
i was looking for this for my download zone website, i will use it as microsoft download senter used.
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back