Hello everyone,
The following javascript codes will not work on the same page. I do not believe the codes are the problem. Since they both work when not being placed on the same page. The top codes rotates an image. And the bottom codes rotates texts.
The image rotater codes does not work when being placed on the same page as the codes for the text rotater.
I suspect it may have something to do with Javascript conflict as explained in the following page:
http://javascriptkit.com/javatutors/multiplejava2.shtml
But can't seem to pinpoint the problem nor could I figure out how to possibly fix the problem ?
Comments, Suggestions anyone ?
I'd really appreciate it. Thanks !
<script language="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
*/
//set image paths
src = ["image1gif", "image2.gif", "image3.gif"]
//set corresponding urls
url = ["link1.html",
"link2.html",
"link3.html"]
//set duration for each image
duration = 2;
//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["Ad_Image"].src = ads[ct=n].src;
}
ads[n=(ct+1)%src.length] = new Image;
ads[n].src = src[n];
setTimeout("switchAd()",duration*1000);
}
function doLink(){
location.href = url[ct];
}
onload = function(){
if (document.images)
switchAd();
}
//-->
</script>
<script type="text/javascript" language="Javascript1.2">
<!-- // Hide
// STEP TWO: change message HTML here
var startHTML = "<center><font color=800000 size=+1><b>"
var endHTML = "</b></font></center>"
var rotateSpeed = 960 // set rotate speed in milliseconds
var myData=new Array()
// STEP THREE: change or add your own message's here
myData[0] = "Topic One"
myData[1] = "Topic Two"
myData[2] = "Topic Three"
// End user modifiable variables
if (document.layers) {
document.write('<ilayer id="NS4message" height=25 width=100%><layer id="NS4message2" height=25 width=100%></layer></ilayer>') temp='document.NS4message.document.NS4message2.document.write(sta rtHTML+myData[cnt++]+endHTML);'+ 'document.NS4message.document.NS4message2.document.close()'
}
else if (document.getElementById) {
document.write(startHTML+'<div id="message" style="position:relative;">IE division</div>'+endHTML)
temp='document.getElementById("message").firstChild.nodeValue=myD ata[cnt++]'
}
else if (document.all) {
document.write(startHTML+'<div id="message" style="position:relative;">IE division</div>'+endHTML)
temp='message.innerHTML=myData[cnt++]'
}
var cnt=0
function rotate(){
eval(temp)
if (cnt==myData.length) cnt=0
setTimeout("rotate()",rotateSpeed)
}
window.onload=rotate
// -->
</script>