I am trying to rotate 5 images (each linking to a page on my website) but the code doesnt seem to work when I put in inside a table.
Anyone have any idea where I am going wrong please?
This is the code in <head> section
<script language=“JavaScript1.2”>
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=‘commercial_cleaning.htm’ ><img alt=‘image0 (9K)’ src=‘rotate/image0.jpg’ border=‘0’ /></a>”; //a linked image
items[1]=“<a href=‘recycle_units.htm’><img alt=‘image1 (9K)’ src=‘rotate/image1.jpg’ border=‘0’ /></a>”; //a linked image
items[2]=“<a href=‘pest_control.htm’><img alt=‘image2 (9K)’ src=‘rotate/image2.jpg’ border=‘0’ /></a>”; //a linked image
items[3]=“<a href=‘washroom_services.htm’><img alt=‘image3 (9K)’ src=‘rotate/image3.jpg’ border=‘0’ /></a>”; //a linked image
items[4]=“<a href=‘window_cleaning.htm’><img alt=‘image4 (9K)’ src=‘rotate/image4.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);
}
The second one is riddled with antiquated layers code and document.all code.
Delete that entire function, plus the var = ns6 declaration near the top, plus the <layer> tag in the markup.
Wipe them all totally, as they belong to the Netscape 4 / IE 4 era of the late 1990s.
Now, the remaining problem in the surviving ‘rotator’ function will show up in your browser error console,
but here it is too:
<div id=“placeholderdiv”>
function rotater() {
document.getElementById(“placeholder”)
This is all aside from any problems you may be having with image locations and loading,
but try fixing the above and see where that takes you.