You are here: irt.org | FAQ | JavaScript | Redirect | Q1205 [ previous next ]
Using the meta tag like:
<meta http-equiv="refresh" content="10 ;url=index.html">
Will either continually reload the same page 10 seconds, or if used with different pages (e.g. index1.htm, index2.htm, index3.htm) will reload three times, but using three different pages.
The following JavaScript solution will give you what you want:
<html> <head> <script language="JavaScript"><!-- var Passed = '' + location.search; if (Passed != '' && Passed != 'undefined') Passed = parseInt(Passed.substring(1)); else Passed = 3; // This will go 3, 2, 1 and stay on 0.... function loopy() { loc = window.location.href sPos = loc.indexOf('?'); if (sPos != -1) loc = loc.substring(0,sPos); // loose existing search window.location = loc + (Passed-1); } //--></script> </head> <body onLoad="setTimeout('loopy()',10000)"> <script language="JavaScript"><!-- document.write(Passed); //--></script> </body> </html>