Javascript not loading (why?)
I have this on a .php page:
<script type="javascript" src="main-img-rotator.js"></script>
var howOften = 5; //number often in seconds to rotate
var current = 0; //start the counter at 0
var ns6 = document.getElementById&&!document.all; //detect netscape 6
// place your images, text, etc in the array elements here
var items = new Array();
items[0]="<a href='link.htm' ><img alt='image0 (9K)' src='img-rot-01.jpg' border='0' /></a>"; //a linked image
items[1]="<a href='link.htm'><img alt='image1 (9K)' src='img-rot-02.jpg' border='0' /></a>"; //a linked image
items[2]="<a href='link.htm'><img alt='image2 (9K)' src='img-rot-03.jpg' border='0' /></a>"; //a linked image
items[3]="<a href='link.htm'><img alt='image3 (9K)' src='img-rot-04.jpg' border='0' /></a>"; //a linked image
items[4]="<a href='link.htm'><img alt='image4 (9K)' src='img-rot-05.jpg' border='0' /></a>"; //a linked image
items[5]="<a href='link.htm'><img alt='image5 (18K)' src='img-rot-06.jpg' border='0' /></a>"; //a linked image
items[6]="<a href='link.htm'><img alt='image5 (18K)' src='img-rot-07.jpg' border='0' /></a>"; //a linked image
items[7]="<a href='link.htm'><img alt='image5 (18K)' src='img-rot-08.jpg' border='0' /></a>"; //a linked image
items[8]="<a href='link.htm'><img alt='image5 (18K)' src='img-rot-09.jpg' border='0' /></a>"; //a linked image
items[9]="<a href='link.htm'><img alt='image5 (18K)' src='img-rot-10.jpg' border='0' /></a>"; //a linked image
items[10]="<a href='link.htm'><img alt='image5 (18K)' src='img-rot-11.jpg' border='0' /></a>"; //a linked image
items[11]="<a href='link.htm'><img alt='image5 (18K)' src='img-rot-12.jpg' border='0' /></a>"; //a linked image
items[12]="<a href='link.htm'><img alt='image5 (18K)' src='img-rot-13.jpg' border='0' /></a>"; //a linked image
items[13]="<a href='link.htm'><img alt='image5 (18K)' src='img-rot-14.jpg' border='0' /></a>"; //a linked image
items[14]="<a href='link.htm'><img alt='image5 (18K)' src='img-rot-15.jpg' border='0' /></a>"; //a linked image
items[15]="<a href='link.htm'><img alt='image5 (18K)' src='img-rot-16.jpg' border='0' /></a>"; //a linked image
function rotater() {
document.getElementById("placeholder").innerHTML = items[current];
current = (current==items.length-1) ? 0 : current + 1;
setTimeout("rotater()",howOften*1000);
}
function rotater() {
if(document.layers) {
document.placeholderlayer.document.write(items[current]);
document.placeholderlayer.document.close();
}
if(ns6)document.getElementById("placeholderdiv").innerHTML=items[current]
if(document.all)
placeholderdiv.innerHTML=items[current];
current = (current==items.length-1) ? 0 : current + 1; //increment or reset
setTimeout("rotater()",howOften*1000);
}
window.onload=rotater;
//--> Not everything is set in the .js file (like alt text, link), but this is just a test version of an image rotator, anyway...
All files, everything is supposed to be on the root directory and it will rotate on my index.php (main) page.
Can't figure out why it's not loading. Probably a small thing I omitted.
Could it be a PHP-HTML issue? Like incompatibility within the script...
Million thanks to anyone who can help!
-
Brandon Tanner -
Thanks
Signature{{ DiscussionBoard.errors[8722054].message }} -
-
shipwrecked -
Thanks - 1 reply
{{ DiscussionBoard.errors[8724963].message }}-
alexstone -
Thanks
{{ DiscussionBoard.errors[8725568].message }} -
-