Can I make Ads Rotate Using Javascript

Discussion in 'JavaScript' started by David Holland, Dec 19, 2010.

  1. #1
    Can I make ads rotate using javascript, If so how do I do this?

    Thanks
     
    David Holland, Dec 19, 2010 IP
  2. tvoodoo

    tvoodoo Active Member

    Messages:
    239
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #2
    tvoodoo, Dec 19, 2010 IP
  3. animebuzz.tv

    animebuzz.tv Peon

    Messages:
    317
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    use setTimeout(); function in javascript


    ex:
    
    <...jqueryframework call.../>
    
    <script type="text/javascript">
    var ad_count = 1;
    
    function reloadAd(){
       if(ad_count == 1){
           $("#adSample").attr("src","ad2.html");
           ad_count = 1;
       }else{
           ad_count = 2;
           $("#adSample").attr("src","ad1.html");
       }
       setTimeout("reloadAd",10000);  
    }
    
    reloadAd();
    </script>
    
    
    <body>
    
    
    <iframe id="adSample" src="ad.html"></iframe>
    
    Code (markup):
    ....
     
    animebuzz.tv, Dec 21, 2010 IP
  4. jbtooloo

    jbtooloo Peon

    Messages:
    206
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4

    Thanks for this :)
     
    jbtooloo, Dec 22, 2010 IP