Reputation: 1
I have a random URL loading script, but I need to change it to ordered, so each link is visited in order(as it rotates on load), then returns to the first and starts again. Any help would be appreciated, especially as javascript is like a foreign language to me.
Code:
var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1
//Specify IFRAME display attributes
var iframeprops='width=100% height=100% marginwidth="0" marginheight="0" hspace="0 vspace="0" frameborder="0" scrolling="yes"'
//Specify random URLs to display inside iframe
var randomcontent=new Array()
randomcontent[0]="slots/001/index.php"
randomcontent[1]="slots/002/index.php"
randomcontent[2]="slots/003/index.php"
randomcontent[3]="slots/004/index.php"
//No need to edit after here
if (ie||dom)
document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')
function random_iframe(){
if (ie||dom){
var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
iframeobj.src=randomcontent[Math.floor(Math.random()*randomcontent.length)]
}
}
window.onload=random_iframe
</script>
Upvotes: 0
Views: 162