View Full Version : Changing the Var Delay Hide (JavaScript Code)

09-02-2008, 03:45 AM
I'm wanting to change the var delay hide from 500 to something like infinite so that my nav bar will when one of the menus is click the sub menus will stay up until another menu is selected.

// Edit the dimensions of the below, plus background color-->
print '<ilayer width=1010 height=20 name="dep1">';
print '<layer name="dep2" width=1010 height=20>';
print '</layer>';
print '</ilayer>';
print '<div id="describe" onClick="clear_delayhide()" onMouseout="resetit(event)"></div>';

<script language="JavaScript1.2">

Tabs Menu (Click)- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use

var submenu=new Array()

//Set submenu contents. Expand as needed. For each content, make sure everything exists on ONE LINE. Otherwise, there will be JS errors.

submenu[0]='<font size="2" face="Verdana"><b><a href="singles.php" target="main">Singles</a> | <a href="tagteams.php" target="main">Tag Team</a> | <a href="stables.php" target="main">Stables</a> | <a href="champions.php" target="main">Champions</a></b></font>'
submenu[1]='<font size="2" face="Verdana"><b><a href="upcomingshow.php" target="main">Upcoming Show</a> | <a href="results.php" target="main">Recent Show Results</a> | <a href="showarchive.php" target="main">Show Archives</a> | <a href="tickets.php" target="main">Tickets</a></b></font>'
submenu[2]='<font size="2" face="Verdana"><b><a href="photos.php" target="main">Show Photos</a> | <a href="kowphotos.php" target="main">KOW Photos</a> | <a href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=380983565">Myspace</a></b></font>'
submenu[3]='<font size="2" face="Verdana"><b><a href="contact.php" target="main">Contact KOW</a> | <a href="titlehistory.php" target="main">History of Champions</a></b></font>'

//Set delay before submenu disappears after mouse moves out of it (in milliseconds)
var delay_hide=500

/////No need to edit beyond here

var menuobj=document.getElementById? document.getElementById("describe") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : ""

function showit(which){
thecontent=(which==-1)? "" : submenu[which]
if (document.getElementById||document.all)
else if (document.layers){

function resetit(e){
if (document.all&&!menuobj.contains(e.toElement))
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))

function clear_delayhide(){
if (window.delayhide)

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;


Philip M
09-02-2008, 07:39 AM
var delay_hide=500

500 milliseconds = half a second.

86400000 milliseconds = one day (24 hours).

The older I grow the more I distrust the familiar doctrine that age brings wisdom.
H.L. Mencken 1880-1956, American Editor, Author, Critic, Humorist