I copied a javascript to change pictures onload on a page. I have this script running successfully in many other pages. This time I am trying to use the same script twice in the same page (with different names) but I am not able to figure out what else should I change to make it work. I can get it to work in one place at the time. I believe I need to rename some of the variables but I am not sure which one.
can anybody help me?
here the 2 scripts:
1
pics.js
2Code:// JavaScript Document //Random iframe content- © Dynamic Drive (www.dynamicdrive.com) //For full source code, and Terms Of use, visit http://dynamicdrive.com //This credit MUST stay intact for use var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1 var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1 //Specify IFRAME display attributes var iframeprops='width="177" height="300" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"' //Specify random URLs to display inside iframe var randomcontent=new Array() randomcontent[0]="../frontpagepics/surfer.html" randomcontent[1]="../frontpagepics/marina.html" randomcontent[2]="../frontpagepics/ruins.html" randomcontent[3]="../frontpagepics/flowers.html" randomcontent[4]="../frontpagepics/lifeguard.html" randomcontent[5]="../frontpagepics/sailboat.html" randomcontent[6]="../frontpagepics/palms.html" if (ie||dom) document.write('<iframe id="dynpics" src="" '+iframeprops+'></iframe>') function random_iframe(){ if (ie||dom){ var iframeobj=document.getElementById? document.getElementById("dynpics") : document.all.dynpics iframeobj.src=randomcontent[Math.floor(Math.random()*randomcontent.length)] } } window.onload=random_iframe
advertisement.js
Code:// JavaScript Document //Random iframe content- © Dynamic Drive (www.dynamicdrive.com) //For full source code, and Terms Of use, visit http://dynamicdrive.com //This credit MUST stay intact for use var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1 var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1 //Specify IFRAME display attributes var iframeprops='width="222" height="320" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"' //Specify random URLs to display inside iframe var randomcontent=new Array() randomcontent[0]="../ads/AdSpace.html" //randomcontent[0]="../ads/siemens.html" //randomcontent[1]="../ads/simplyHearing.html" //randomcontent[2]="../ads/transear.html" //randomcontent[3]="../ads/westone.html" //randomcontent[0]="../ads/Vivosonic.html" //randomcontent[1]="../ads/audigyGroup.html" //randomcontent[2]="../ads/westone.html" //randomcontent[2]="../ads/SoundCure.html" //randomcontent[3]="../ads/audigyGroup.html" //randomcontent[4]="../ads/transear.html" //randomcontent[5]="../ads/audigyGroup.html" //randomcontent[6]="../ads/SilentCall.html" //randomcontent[6]="../ads/realEar.html" //No need to edit after here if (ie||dom) document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>') function random_iframe(){ if (ie||dom){ var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff iframeobj.src=randomcontent[Math.floor(Math.random()*randomcontent.length)] } } window.onload=random_iframe



Reply With Quote

Bookmarks