Coinbase

Author Topic: Java Code  (Read 3190 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
Java Code
« on: August 26, 2006, 02:36:08 pm »
I sell space on my forum, we are a parenting site for parents of twins triplets and more, so I use my own ads custom made for my forum. Here is the java I use to display them.

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

i = 4 // Number of banners that you have
banner1 = new Image();
banner1.src = "image one here";
banner2 = new Image();
banner2.src = "image two here";
banner3 = new Image();
banner3.src = "image three here";
banner4 = new Image();
banner4.src = "image four here";



links = new Array
links[1] = "url 1"
links[2] = "url 2"
links[3] = "url 3"
links[4] = "url 4"



text = new Array
text[1] = "alt text"
text[2] = "alt text"
text[3] = "alt text"
text[4] = "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 < 4){
                        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="your url here" onClick="clickLink(); return false;" onMouseOver="descript(); return true;" onMouseOut="window.status=''"><img src="your imgar here" border=0 name="banner"></a></center>

Offline jerm

  • Support
  • Elite Member
  • *
  • Posts: 726
Re: Java Code
« Reply #1 on: August 26, 2006, 04:29:18 pm »
so the problem is it doesn't display?

Offline AMBA

  • Newbie
  • *
  • Posts: 7
  • Give me ambuguity or give me something else.
    • AMBA Community Forum
Re: Java Code
« Reply #2 on: September 18, 2006, 06:20:39 am »
no no it works. I'm just sharing it with others.

Offline bigguy

  • Support
  • Elite Member
  • *
  • Posts: 1518
    • SMF Helper
Re: Java Code
« Reply #3 on: September 18, 2006, 07:24:52 pm »
Thats great thanks AMBA for the code. ;)

Offline vatso

  • Newbie
  • *
  • Posts: 5
Re: Java Code
« Reply #4 on: August 27, 2007, 07:21:08 am »
Is there anyway a person can make it that it only uploads one random pic at a time & does not scroll?

if so how does one do that

Thanks inadvance - nice Java stuff

SMF Ads Support Forum

Re: Java Code
« Reply #4 on: August 27, 2007, 07:21:08 am »
.

 

.