Forum Moderators: open
<html>
<head>
<title>:::show.hide:::</title><script language="JavaScript">
<!--
// Show layer function
function Show(id, visibility) {
obj = document.getElementsByTagName("div");
obj[id].style.visibility = "visible";
}
// Hide layer function
function Hide(id, visibility) {
obj = document.getElementsByTagName("div");
obj[id].style.visibility = "hidden";
}
//-->
</script>
<style type="text/css">
<!--
#sub1Div
{
visibility:hidden;
width:80px;
height:80px;
position:absolute;
left:200px;
top:20px;
border:1px solid #151515;
}
-->
</style>
</head>
<body>
<div id="sub1Div"> sub1</div>
<p>
<a href="#"
onmouseover="Show('sub1Div','visible')"
onmouseout="Hide('sub1Div','hidden')">
showhide.sub1
</a>
</p>
</body>
</html>
onmouseout=setTimeout("Hide('sub1Div','hidden')",50000) ?
And in this case 'sub1Div' and 'hidden' are undefined?
Would you please post your timeout code?
Off the top, you may want to initialize a couple of variables onmouseover to make this a little more simple:
onmouseover="thisdiv='sub1Div';hidestate='hidden';Show(thisdiv,'visible')" onmouseout="hideit=setTimeout('Hide(thisdiv,hidestate)',50000)" And in your Hide function:
function Hide(div,state) { clearTimeout(hideit); etc... BTW: Welcome to the forums! :)