topical media & game development
sample-js-cycle.js / js
local var(s)
var siteindex = 0;
var stopchange = 0;
function firstsite() {
siteindex = 0;
nextsite();
}
change
function changesite() {
var i = Math.floor((Math.random() * 100) % site.length);
frames["profileplace"].location.href=site[i];
var place = document.getElementById("loaded");
place.innerHTML = " " + (i+1) + "/" + site.length + " " + site[i];
}
next
function nextsite() {
if (siteindex >= site.length) siteindex = 0;
frames["profileplace"].location.href=site[siteindex];
var place = document.getElementById("loaded");
place.innerHTML = " " + (siteindex+1) + "/" + site.length + " " + site[siteindex];
siteindex++;
//alert(siteindex);
}
start
function startsite() {
setInterval(function() {
var k = Math.floor((Math.random() * 100) % site.length);
frames["profileplace"].location.href=site[k];
var place = document.getElementById("loaded");
place.innerHTML = " " + (k+1) + "/" + site.length + " " + site[k];
},4000);
}
control(s)
document.write("<h5 align=right><font color=red>");
document.write("<a href=\"javascript:startsite();\">start</a> / <a href=\"javascript:changesite();\">change</a> / <a href=\"javascript:nextsite();\">next</a>");
document.write("</font></h5>");
document.write("<h6 align=left><font color=#DDD><div id=loaded></div></font></h6>");
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.