Friday 10, February 2012
Welcome Guest, Register | Login  
      Home    |    Tutorials    |    Free Ebooks    |    Free Scripts    |    Articles    |    Blog     |    Forum    |    About Us    |    Contact Us

  javascript collapsible menu script

Here is a javascript collapsible menu that turn into submenus. Useful for things like categorizing subjects and a table of contents.
Cut & Paste Script
<a href="#" onclick="collapse_menu(menu1, 0); return false">Menu 1</a><br>
<span id="menu1"></span>
<a href="#" onclick="collapse_menu(menu2, 1); return false">Menu 2</a><br>
<span id="menu2"></span>

<script language="javascript">
var on_off=new Array();
var menu_code=new Array();

number_of_menus=2;

menu_code[0]="Option 1<br>Option 2<br>Option 3<br>";
menu_code[1]="Option 1<br>Option 2<br>Option 3<br>";

for (loop=0; loop<number_of_menus; loop++){
 on_off[loop]=0;
}

function collapse_menu(menu_id, menu_number){
  if (on_off[menu_number]==0){
    menu_id.innerHTML=menu_code[menu_number];
    on_off[menu_number]=1;
  }else{
    menu_id.innerHTML="";
    on_off[menu_number]=0;
  }
}
</script>
 
   
     RELATED SCRIPTS
 
A sample JSON definition
JavaScript Object Notation, has become a popular alternative to XML for defining structured data using JavaScript.
In strict JSON:
  • All string values must be in double quotes (single quotes won't do).
  • The name portion of each name/value pair must also be ...more »
Category : JavaScript Examples Hits : 359
   
Add or Change Options on a form select field using javascript
This script can be used to add or change options on a form select menu.
...more »
Category : JavaScript Examples Hits : 819
   
Creating a Popup Once Window using JavaScript
Popup windows are everywhere on the web. Use this script to add one to your site that is NOT annoying, since it only pops up once. Try leaving then coming back to this page- no more popup. ...more »
Category : JavaScript Examples Hits : 322
   
popup window using javascript
This javascript can be used to create a popup window. It will display a mini popup window when page loads....more »
Category : JavaScript Examples Hits : 286
   
Toggle a DIV using JavaScript
Here is a javascript function to toggle a div object. Once you click the Show/Hide link, the Div object will become invisible. It will become visible by clicking the Show/Hide link again....more »
Category : JavaScript Examples Hits : 456
   
   
SCRIPT CATEGORIES
 
  C Programs
C Programs scripts
  C++ Programs
C++ Programs scripts
  Java Programs
Java Programs scripts
  JavaScript Examples
JavaScript Examples scripts
  PHP Examples
PHP Examples scripts
  VBScript Examples
VBScript Examples scripts
 
 
 
POPULAR E-BOOKS
 
Download Hidden Internet Revenue Resources Ebook Hidden Internet Revenue Resources
   
Download Data Structures and Algorithms with Object-Oriented Design Patterns in C++  Ebook Data Structures and Algorithms with Object-Oriented Design Patterns in C++
   
Download Its An Internet Jungle Out There Ebook Its An Internet Jungle Out There
   
Download BMA s Internet Marketing Articles Vol I  Ebook BMA s Internet Marketing Articles Vol I
   
Download Landing Page Success Guide to Millions Ebook Landing Page Success Guide to Millions
   
 
Studiesinn.com © 2012 All Rights Reserved.
Website Designed & Developed by TechXprtz