Trevor said:
This needs a bit of thought (well, by me, anyway). If I am making
sense, and you understand what I am on about, maybe you can take it
from there. Otherwise I will try out my ideas and post back if I
solve it. --
dancer,
Well I tried and I failed.
At one stage, I got close to it - pages were opening in sequence, but there
were errors and when I corrected them, what worked before no longer did.
What I have is several pages exactly the same:
test.html (the base page)
test1.html ]
test2.html ] the pages to called in sequence from test.html
test3.html ]
They look like this
<html>
<head>
<script type="text/javascript" src="scripts/timer.js"></script>
</head>
<body onload="timer()">
This is test.html
</body>
</html>
By varying what is in body, you will see which page is loaded
The file timer.js is
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)
// alert('fileno: ' + fileno)
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'
// alert(filename)
if (filename!='do nothing')
setTimeout("location.href=" + filename,5000)
}
//--------------------------------
The idea is that test.html is loaded first and calls timer().
Since fileno is null (I have tested this and it is), timer() sets filename
to 'test1.html?fileno=1' (also tested)
setTimeout then calls :
location.href=test1.html?fileno=1 after a 5 second delay.
This should load test1.html with the parameter fileno set to 1
This same process continues with test2.html and test3.html
test3.html returns to test.html with fileno set to 4, so when test.html
executes timer(), filename is 'do nothing' and setTimeout is not invoked, so
no further cycling through the files take place
The problem is that it fails with a message
Line: 2
Char: 1
Error: Expected ":"
This is ridiculous as there is no code at Line 2.
Removing various bits of code ans retesting seems to indicate that the erro
is in setTimeout. Yet I can see nothing wrong wih it
dancer,
You may longer be wanting to follow this up, but if anyone can diagnose
this, I would be interested as it has me stumped
Cheers,
Trevor L.
Website:
http://tandcl.homemail.com.au