popups array

Discussion in 'JavaScript' started by dramiditis, Aug 15, 2009.

  1. #1
    Hi,

    Can someone give me example like this:

    I have array of pages:

    1. google.com
    2.yahoo.com
    3.msn.com
    4...
    5...

    And when my page loads I want to open with "onload" popups with pages from array, but for each array page one popup. And if its possible deley beatween popups opening for 2-3 seconds.

    Thanks
     
    dramiditis, Aug 15, 2009 IP
  2. WillyR

    WillyR Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Sure it is, when the page is loaded call a function that will set an interval (basically a timer), be sure to clear it once all your popups are launched though.
     
    WillyR, Aug 21, 2009 IP
  3. Mastermaniac

    Mastermaniac Peon

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    
    <script type="text/javascript">
    var x=new Array("http://www.google.com","http://www.yahoo.com","http://www.msn.com");
    var i=0;
    function popit(){
    if(i==x.length-1){
    return;
    }
    else
    {
    window.open(x[i]);i+=1
    }
    }
    setInterval(popit,1000);
    </script>
    
    Code (markup):
    Simple :p
     
    Mastermaniac, Aug 22, 2009 IP