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
https://forums.phpfreaks.com/topic/159500-menu-timeout/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.