var in_pages="01020304050607080910";
var i;
var pages = "";
var oo = "foo";
for (i=0; i<1 0; i++)br>
{
var out_pages="";
var n = Math.round((10-i) * Math.random());
pages = "" + pages + in_pages.substring(n*2, n*2+2);
if (n>0)
{
out_pages = ""+in_pages.substring(0, n*2);
}
if ( (n*2)+2 < in_pages.length)br>
{
out_pages = ""+out_pages + in_pages.substring((n*2)+2, in_pages.length);
}
in_pages = out_pages;
}
pages=pages.substring(2,20);
window.location.href="http://localhost/page" + in_pages + ".html?pages="+pages;
>1>
In each of page01 through page10.html:
function nextPage()
{
var pages = location.href.substring(location.href.indexOf('=')+1, location.href.length);
var next_page = pages.substring(0,2);
if (pages.length==0)
window.location.href="http://localhost/finalpage";
else
{
pages = pages.substring(2, pages.length);
window.location.href="http://localhost/page" + next_page + ".html?pages="+pages;
}
}
remove the spurious br's it appears on preview that metafilter has added to the ends of lines...<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Slideshow</title>
</head>
<frameset rows="56,*">
<frame src="slideshow.html" />
<frame src="main.html" id="slideshow" />
</frameset>
</html><!DOCTYPE
html PUBLIC "-//W3C//DTD XHTML 1.0//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Slideshow</title>
<script type="text/javascript">
// <![CDATA[
// List of pages to display in the slideshow.
var pages = [
"1.html",
"2.html",
"3.html",
"4.html",
"5.html",
"6.html",
"7.html",
"8.html",
"9.html",
"10.html"
];
// Number of seconds to delay between pages.
var delay = 5;
function startSlideShow() {
var frame = top.document.getElementById("slideshow");
// Randomize the order of the pages.
for (var i = 0; i < pages.length; ++i) {
var j = Math.floor(10 * Math.random());
var pageI = pages[i];
var pageJ = pages[j];
pages[i] = pageJ;
pages[j] = pageI;
}
// Display each page in turn with a <delay>-second pause between each page.
for (var i in pages) {
(function() {
var page = pages[i];
setTimeout(
function() {
frame.src = page;
},
i * delay * 1000
);
}) ();
}
// After the last page is done, show the original page.
setTimeout(
function() {
frame.src = "main.html";
},
pages.length * delay * 1000
);
}
// ]]>
</script>
</head>
<body>
<a href="javascript:startSlideShow()">Slide Show!</a>
</body>
</html>
<meta http-equiv="Refresh" content="n;url">
where "n" stands for the number of seconds you want the browser to wait and "url" is the address of the next page you want it to load. It's been a while since I've used this, but I think "url" needs to be an absolute URL (like you would see in the browser's address bar) not a relative URL (just the file name).
In order to get a randomized list, you'll need to use PHP or something like it. Does your web host support PHP?
posted by Mars Saxman at 10:49 AM on June 1, 2005