Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1754 How can I execute a function every 10 seconds?

You are here: irt.org | FAQ | JavaScript | Window | Q1754 [ previous next ]

Try either:

<html>

<head>

<script language="JavaScript"><!--
// v3 compatible:
function doSomething() {
   // do something here...
   setTimeout('doSomething()',10000);
}
//--></script>

</head<

<body onLoad="doSomething()">
...
</body>

</html>

or:

<html>

<head>

<script language="JavaScript"><!--
// v4 compatible:
function doSomething() {
  // do something here...
}

setInterval('doSomething()',10000);
//--><script>

<body>
...
</body>

</html>

©2018 Martin Webb