Coinbase

Author Topic: Two java scripts running??  (Read 2172 times)

0 Members and 1 Guest are viewing this topic.

Offline AMBA

  • Newbie
  • *
  • Posts: 7
  • Give me ambuguity or give me something else.
    • AMBA Community Forum
Two java scripts running??
« on: October 09, 2007, 03:21:28 pm »
Do you guys know if I am able to have two rotate scripts running  at the same time?

I have a working rotate script running ads at the bottom or top of my forum by never both. My ads rotate every 5 seconds and are clickable.

Code: [Select]
<script language="JavaScript">

i = 9 // Number of banners that you have
banner1 = new Image();
banner1.src = "insert image";
banner2 = new Image();
banner2.src= "insert image";
banner3 = new Image();
banner3.src = "insert image";
banner4 = new Image();
banner4.src = "insert image";
banner5 = new Image();
banner5.src = "insert image";
banner6 = new Image();
banner6.src = "insert image";
banner7 = new Image();
banner7.src = "insert image";
banner8 = new Image();
banner8.src = "insert image";
banner9 = new Image();
banner9.src = "insert image";


//URL's go here
links = new Array
links[1] = "link 1";
links[2] = "link 2";
links[3] = "link 3";
links[4] = "link 4";
links[5] = "link 5";
links[6] = "link 6";
links[7] = "link 7";
links[8] = "link 8";
links[9] = "link 9";

text = new Array
text[1] = "alt text"
text[2] = "alt text"
text[3] = "alt text"
text[4] = "alt text"
text[5] = "alt text"
text[6] = "alt text"
text[7] = "alt text"
text[8] = "alt text"
text[9] = "alt text"

function randombanner(){
var randomnumber = Math.random();
i = Math.round( (i - 1) * randomnumber) + 1;
document.banner.src = eval("banner" + i + ".src");
}

function startTime(){

        var time= new Date();
        hours= time.getHours();
        mins= time.getMinutes();
        secs= time.getSeconds();
        closeTime=hours*3600+mins*60+secs;
        closeTime+=5;
        Timer();

}

function Timer(){
        var time= new Date();
        hours= time.getHours();
        mins= time.getMinutes();
        secs= time.getSeconds();
        curTime=hours*3600+mins*60+secs
        if (curTime>=closeTime){
                if (i < 9){
                        i++;
                        document.banner.src = eval("banner" + i + ".src");
                }
                else{
                        i = 1;
                        document.banner.src = eval("banner" + i + ".src");
                }
                startTime();
        }
        else{
                window.setTimeout("Timer()",1000)}

}

function clickLink(){
        top.location = links[i]
}

function descript(){
        window.status = description[i]
}

// -->

</script>

<body onLoad="randombanner(); startTime();">

<center><a href="link goes here" onClick="clickLink(); return false;" onMouseOver="descript(); return true;" onMouseOut="window.status=''"><img src="path to image here" border=0 name="banner"></a></center>

This code works really well but in one instance only.

Offline bigguy

  • Support
  • Elite Member
  • *
  • Posts: 1518
    • SMF Helper
Re: Two java scripts running??
« Reply #1 on: October 14, 2007, 02:42:27 pm »
It would be best to ask the author of that code. I don't see why it wouldn't be able to work.

Offline AMBA

  • Newbie
  • *
  • Posts: 7
  • Give me ambuguity or give me something else.
    • AMBA Community Forum
Re: Two java scripts running??
« Reply #2 on: October 15, 2007, 03:16:26 pm »
Unfortunately it's kinda mine... and kinda not.  I train smashed 3 or 4 that didn't quite work correctly together. To create this one that does work on SMF. NM  I'll figure it out.

SMF Ads Support Forum

Re: Two java scripts running??
« Reply #2 on: October 15, 2007, 03:16:26 pm »
.

 

.