I a, developing a site that has an auto-redirect on page load whereby it loops through a sequence of pages. This works perfectly. I also have a link I click to stop the auto-redirect. The auto-redirect uses a function called redirTimer() and the "stop" link calls a function called stopredir() - The latter also adds a suffix to the URL of the "Next Page" link so it changes the hyperlink from example.com/page2 to example.com/page2&noslide - Both of these functions work perfectly.
What I need to do now, also on page load, is check for that &noslide variable so I can call the stopredir() function right away if it exists. I don't want the user to have to click the stop button again if they already clicked it on the previous page. I have got a noslide() function to check for this but it isn't working.
When my page loads, I am calling the noslide() function after the redirTimer() function.
redirTime = "5000";
redirURL = "example.com";
settime=self.setTimeout("self.location.href = redirURL;",redirTime);
document.getElementById('slideshow').innerHTML='<a href=# onclick="stopredir()">Stop Slideshow</a>';
document.getElementById('slideshow').innerHTML='<a href=# onclick="redirTimer()">Start Slideshow</a>';
document.getElementById('next-nav').innerHTML='<a class="next-link" href="example.com&noslide">NEXT</a>';
The redirTimer() still starts up automatically, even if it was stopped on the previous page.
I have checked and the variable has been added to the end of the URL and the redirect was stopped when I clicked it. So the noslide() function is clearly not working.
Please can somebody tell me what I am doing wrong?