Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Waiting five secsonds before doing somthing 1

Status
Not open for further replies.

ChrisMacPherson

Programmer
Jul 3, 2000
157
GB
Hello,

I am trying to make some games for little people and what I am trying to do is to have a hidden layer on a page and when the mouse is over it for at least 5 seconds it should appear.

If the mouse is not held over the layer for at least 5 seconds then nothing should happen.

Any ideas about how this should be done, or can it be done?

Thanks for any help...
Chris MacPherson
macpweb@hotmail.com


 
hi Chris,

here's an example:
[tt]
<html>
<head>
<title></title>

<script language=&quot;javascript&quot;>
var timer;

function start() {
timer = window.setTimeout(&quot;document.getElementById('target').style.visibility = 'visible';&quot;,5000);
}

function stop() {
window.clearTimeout(timer);
}
</script>

<style type=&quot;text/css&quot;>
#container {
height:200px;
width:200px;
padding:10px;
border:1px solid black;
}
#target {
visibility:hidden;
background-color:#cccccc;
padding:5px;
width:100%;
height:100%;
}
</style>

<meta http-equiv=&quot;Pragma&quot; content=&quot;no-cache&quot;>

</head>

<body>
<form>
<div id=&quot;container&quot; onmouseover=&quot;start();&quot; onmouseout=&quot;stop();&quot;>
<div id=&quot;target&quot;>target</div>
</div>
</form>
</body>
</html>

[/tt]
=========================================================
if (!succeed) try();
-jeff
 
Thanks a lot jemminger,

You've just saved me a good couple of hours that I dont have.

Cheers :)

Chris MacPherson


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top