Hi
I have some js which is currently in the header of the page and works perfectly. When I take the js, put it in a seperate file and set that as src="testimonials.js" it doesn't work.
Any clues?
I have some js which is currently in the header of the page and works perfectly. When I take the js, put it in a seperate file and set that as src="testimonials.js" it doesn't work.
Any clues?
Code:
var NS4 = (document.layers) ? 1 : 0;
var IE4 = (document.all) ? 1 : 0;
onload = start;
var ar = new Array();
ar[0] = "Quote1";
ar[1] = "Quote2";
ar[2] = "Quote3";
ar[3] = "Quote4";
var num = 0;
function start() {
setInterval("update()", 1000); //Sets interval for update in 1000 of a second, i.e. 4000 = 4 seconds
}
function update() {
display("banner", ar[num]);
num++;
if (num == ar.length) num = 0;
}
function display(id, str) {
if (num%2) str = "<font color=red>" + str + "<font>"; //Makes every second quote appear in red
if (NS4) {
with (document[id].document) {
open();
write(str);
close();
}
} else {
document.all[id].innerHTML = str;
}
}