SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Popunders

  1. #1
    SitePoint Zealot
    Join Date
    Apr 2003
    Location
    Texas, USA
    Posts
    139
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Popunders

    Hi all,

    I'm trying to do something very simple, but since I don't know much Java Script, I'm having a bit of a problem.

    I'm using the following code to display a popunder on my webpage:

    Code:
    <script language='javascript'>
     <!--
     var WSGPoPuPWindow=null;
     function WSGPoPuP(mypage,myname,w,h,pos,infocus){
     if(pos=='center'){
     LeftPosition=(screen.width)?(screen.width-w)/2:100;
     TopPosition=(screen.height)?(screen.height-h)/2:100;}
     else {LeftPosition=5;TopPosition=5;}settings='width='+ w + ',height='+ h + ',top=' 
    + TopPosition + ',left=' + LeftPosition  ',location=yes,directories=yes,menubar=yes,
    toolbar=yes,status=yes,scrollbars=yes,resizable=yes,dependent=yes';
     WSGPoPuPWindow=window.open('',myname,settings);
     if(infocus=='back'){WSGPoPuPWindow.blur();WSGPoPuPWindow.location='http://www.yahoo.com';
    WSGPoPuPWindow.blur();}
     if(infocus=='front'){WSGPoPuPWindow.focus();WSGPoPuPWindow.location='http://www.yahoo.com';}
     }
     //-->
     </script>
    And inside the BODY:

    Code:
    <body onLoad="WSGPoPuP('http://www.yahoo.com','WSGPoPuP','800','600','center','back');">
    When the visitor arrives at the site, the popunder appears, and this popunder is THE active window.

    However, I want my website to be the active window, and the popunder window to be "quiet at the back".

    I tried messing with the "infocus" "back" "front" functions, but I couldn't get it right.

    Any help is very appreciated.

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    I just ran your script -- and after fixing an unterminated string error ( the ' + TopPosition' line ) -- it worked --> the yahoo page was behind the page that contained the code.
    BTW: many people do not like unsolicitated popups -- regardless of what you call them.

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2003
    Location
    Texas, USA
    Posts
    139
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your help


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •