I need help to change the JS

Discussion in 'JavaScript' started by leeku, Jan 8, 2015.

  1. #1
    I think the code will show the ad at random,but i want the ad be load one by one ,5s interval
    anyone help me will be appreciated or is there have another codes to do the job?


    <script language=”javascript”>
    var how_many_ads = 3;
    var now = new Date()
    var sec = now.getSeconds()
    var ad = sec % how_many_ads;
    ad +=1;
    if (ad==1) {
    txt=”“;
    url=”“;
    alt=”“;
    banner=”“;
    width=”468″;
    height=”60″;
    }
    if (ad==2) {
    txt=” “;
    url=” “;
    alt=” “;
    banner=” “;
    width=”468″;
    height=”60″;
    }
    if (ad==3) {
    txt=” “;
    url=” “;
    alt=” “;
    banner=” “;
    width=”468″;
    height=”60″;
    }
    document.write(’<center>’);
    document.write(’<a href=”‘ + url + ‘” target=”_top”>’);
    document.write(’<img src=”‘ + banner + ‘” width=’)
    document.write(width + ‘ height=’ + height + ‘ ‘);
    document.write(’alt=”‘ + alt + ‘” border=0><br>’);
    document.write(’<small>’ + txt + ‘</small></a>’);
    document.write(’</center>’);
    </script>
     
    leeku, Jan 8, 2015 IP
  2. freelanceDeveloper

    freelanceDeveloper Member

    Messages:
    59
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    43
    #2
    Check this out, with a bit of tweaking it will do the job ;)

    http://stackoverflow.com/questions/11350993/using-jquery-loop-to-alternate-image-scr
     
    freelanceDeveloper, Jan 11, 2015 IP