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;">

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.