PDA

View Full Version : javascript event



mrchang
06-08-2005, 01:57 AM
hi everybody

i made page using asp to view some data from database. but i have problem with javascript. because that page must refresh every 20 secaonds (counter down) if there are some key storke or mouse event so timer must restart (become 20).

can u help me?

NCS_One
06-11-2005, 03:15 AM
Hi

Dont know if there are better ways to do it but this one works.

In the HEAD tag put this
------------------------------------------------------------
function LoadWindow() {
window.open("PageName","_self");
}
</script>
<script language="JavaScript">
var timer=setTimeout("LoadWindow()",20000);
</script>
------------------------------------------------------------
Dont forget to put the PageName.

If this is what you were looking for please say something back.

mrchang
06-13-2005, 02:34 AM
no. i know how to counter down timer. but i want make timer restart when mouse is moved or we press keyboard.
(like sreen saver)

thanks

jscheuer1
06-13-2005, 06:01 AM
See:

http://www.quirksmode.org/js/events_compinfo.html

example:
<script type="text/javascript">
document.onmousedown=function(){alert('down')};
document.onkeydown=function(){alert('down')};
</script>