Can someone help me with this ?

Discussion in 'JavaScript' started by DjZoC, Jan 27, 2011.

  1. #1
    Hello there, this is my script

       var puShown = false;
    
       function doOpen(url)
       {
               if ( puShown == true )
               {
                       return true;
               }
    
               win = window.open(url, 'wmPu', 'toolbar,status,resizable,scrollbars,menubar,location,height=680,width=790');
               if ( win )
               {
                       win.blur();
                       puShown = true;
               }
               return win;
       }
       
       
       function setCookie(name, value, time)
       {
           var expires = new Date();
           
           expires.setTime( expires.getTime() + time );
           
           document.cookie = name + '=' + value + '; expires=' + expires.toGMTString();
       }
       
       
       function getCookie(name) {
           var cookies = document.cookie.toString().split('; ');
           var cookie, c_name, c_value;
           
           for (var n=0; n<cookies.length; n++) {
               cookie  = cookies[n].split('=');
               c_name  = cookie[0];
               c_value = cookie[1];
               
               if ( c_name == name ) {
                   return c_value;
               }
           }
           
           return null;
       }
    
    
       function initPu()
       {
               if ( document.attachEvent )
               {
                       document.attachEvent( 'onclick', checkTarget );
               }
               else if ( document.addEventListener )
               {
                       document.addEventListener( 'click', checkTarget, false );
               }
       }
       
       
       function checkTarget(e)
       {
           if ( !getCookie('popundr') ) {
               var e = e || window.event;
               var win = doOpen('http://www.google.com');
               
               setCookie('popundr', 1, " . $popexpire . ");
           }
       }
    
       initPu();
    Code (markup):
    can someone please tell me how i can make this popup code to open 2 websites disame time ? example to open www.google.com and www.yahoo.com

    Thanks
     
    DjZoC, Jan 27, 2011 IP
  2. guardian999

    guardian999 Well-Known Member

    Messages:
    376
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #2
    You can do this
       function checkTarget(e)
       {
           if ( !getCookie('popundr') ) {
    
               var e = e || window.event;
               var win = doOpen('http://www.google.com');
               var win2 = doOpen('http://www.google.com');
    
               setCookie('popundr', 1, " . $popexpire . ");
           }
       }
    
    
    HTML:
     
    guardian999, Jan 27, 2011 IP
  3. DjZoC

    DjZoC Member

    Messages:
    167
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    hi there, i try your code but didnt work :( can you please take a look, he open just the first link not and the win2
     
    DjZoC, Jan 29, 2011 IP