jasonc Posted November 23, 2011 Share Posted November 23, 2011 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;"> Quote Link to comment https://forums.phpfreaks.com/topic/251671-onload-not-working-in-ie-google-chrome-safari-and-avant/ Share on other sites More sharing options...
jasonc Posted November 23, 2011 Author Share Posted November 23, 2011 changed the document["id"] to document.getElementById('id') and works in all browsers. Quote Link to comment https://forums.phpfreaks.com/topic/251671-onload-not-working-in-ie-google-chrome-safari-and-avant/#findComment-1290696 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.