Jump to content

Menu Timeout


bftwofreak

Recommended Posts

I'm trying to do a simple appear/disappear trick with a submenu that appears onmouseover the button and the submenu and disappears 1 second after mouseout of the submenu and the button. Below is the javascript code.

var t
function showMenu(id)
{
clearTimeout(t);
document.getElementById(id).style='visibility: visible;';
}

function hideMenu(id)
{
t=setTimeout(document.getElementById(id).style='visibility:hidden;',1000);
}

Below is the final html of the page after a system of php files contribute.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>New Vision Church</title>
<link rel="stylesheet" type="text/css" href="req/style.css" />
<script language="text/javascript" src="req/submenu.js"></script>
</head><body>
<div id="corner" class="top-left"><img src="images/top-left.gif" /></div>
<div id="title" class="title"><img src="images/title.gif" /><p class="title_text">New Vision Presbyterian NCD</p></div>
<div id="Links" class="links"><img src="images/links.gif" /><br />
<a class="link" style="top:8px;" href="?pg=Home" onmouseover="showMenu('Home')" onmouseout="hideMenu('Home')">Home</a>
<img src="images/links.gif" /><br />
<a class="link" style="top:58px;" href="?pg=User" onmouseover="showMenu('User')" onmouseout="hideMenu('User')">User</a>

<img src="images/links-bottom.gif" /></div>
<div id="User" class="sub_div" style="top:180px"  onmouseover="showMenu('User')" onmouseout="hideMenu('User')"><table>
<tr><td><a class="sub_link" href="?pg=User&sub=Login">Login</a></td></tr>
<tr><td><a class="sub_link" href="?pg=User&sub=Register">Register</a></td></tr>
</table></div><div id="body" class="body"></div>
</body></html>

 

My issue is that I already have the div with the id of User set to be hidden. My problem is that the submenu won't appear. is it an issue with the final html or an issue with the JS?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.