Cycling through several pages - Attention Dancer

T

Trevor L.

BlankResent
(Thanks to Walter Zackery for correcting my code)
Dancer,

Here is the code which cycles through several pages

test.html
test1.html
test2.html
test3.html
Alter the body to show which page you are on

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="scripts/timer.js"></script>
</head>
<body onload="timer()">
This is test.html
</body>
</html>

// timer.js
function qsobj(parm)
{
var qpairs = document.location.search.substring(1).split("&")
var qvbl = qpairs[parm].split("=")
return qvbl[1] ? unescape(qvbl[1].replace(/%20|\ +/g," ")) : null
}
//------------------------------
var fileno = qsobj(0)
function timer()
{
var filename
= (fileno == null) ? 'test1.html?fileno=1'
: (fileno == 1) ? 'test2.html?fileno=2'
: (fileno == 2) ? 'test3.html?fileno=3'
: (fileno == 3) ? 'test.html?fileno=4'
: 'do nothing'
if (filename != 'do nothing')
setTimeout('window.location="' + filename + '"',5000)
}
//------------------------------

Once you get back to test.html it does not cycle any more.
 
Top