You are here: irt.org | FAQ | JavaScript | Random | Q467 [ previous next ]
It would be possible to store a number in a cookie that would indicate to a user that later returns to display a different page - although not everyone accepts cookies. An easier approach would be to show a page depending on the time of day. The following assumes that there are pages index1.html through to index24.html
<SCRIPT LANGUAGE="JavaScript"><!-- var now = new Date(); var hour = now.getHours() + 1; if (document.images) location.replace('http://www.somewhere.com/index' + hour + '.html'); else location.href = 'index' + hour + '.html'; //--></SCRIPT>
Note: in Opera replace() will work, but only with absolute URL's.