Jump to content

onload not working in IE, Google Chrome, Safari and Avant


jasonc

Recommended Posts

Firefox works a dream, but in IE, Google Chrome, Safari and Avant javascript does not run at all.  Looking at the code it may be the body 'onload' that is not firing?

 

Has anyone got any advise on this on how I might be able to fix it.

 

the javascript

/*	Script by FPMC at http://jsarchive.8m.com	Submitted to JavaScript Kit (http://javascriptkit.com)	For this and 400+ free scripts, visit http://javascriptkit.com	*/

src = ['../images/Intro_01.png', '../images/Intro_02.png', '../images/Intro_03.png', '../images/Intro_04.png', '../images/Intro_05.png', '../images/Intro_06.png'];	//set image paths

// url = ['http://freewarejava.com', 'http://javascriptkit.com', 'http://dynamicdrive.com', 'http://www.geocities.com'];	//set corresponding urls

duration = 3;	//set duration for each image

//Please do not edit below
ads=[]; ct=0;
function switchAd() {
var n=(ct+1)%src.length;
if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
document['Intro_Image'].src = ads[ct=n].src;
}
ads[n=(ct+1)%src.length] = new Image;
ads[n].src = src[n];
setTimeout('switchAd()',duration*1000);
}

 

the body tag

<body onload="switchAd(this);">

 

the img tag

<img id="Intro_Image" src="images/Intro_01.png" alt="slideshow" style="width: 230px; border: 0;">

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.