SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: Pop Up Logic

Hybrid View

  1. #1
    Technically, a bit dim macdan's Avatar
    Join Date
    Feb 2001
    Location
    London
    Posts
    344
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pop Up Logic

    Hi there Sitepoint

    I have a page where users link to content which appears in smaller pop up windows.

    In my current set up when a user calls a pop up window and then clicks on the (original) browser window behind it, the pop up obviously dissappears behind. If the user then calls another pop up the content of the pop up changes but stays hidden behind the original window.

    Is there anyway of bringing this forward to the front?

    I use this script to generate pop ups:

    function windowOpener() {
    window.open('','win','toolbar=no,location=no,scrolling=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width=500,height=500,top=20,left=20');
    }

    calling the function using this:

    <a href="content.html" target="win" onclick="windowOpener()">


    Any help would be much appreciated!
    gorillaweb is a small London based digital design agency.

  2. #2
    SitePoint Addict
    Join Date
    Nov 2000
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This works well for IE5.x but had the same prob as you with NN6.

    |-----The Script-----|

    <Script LANGUAGE="JavaScript">
    <!--
    Global_Current_Win = null;
    function my_win()
    {
    if(Global_Current_Win){Global_Current_Win.close()}
    Global_Current_Win = window.open('yourpage.htm','mywindow','width=200,height=250,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,left=5,top=5');
    }
    //-->
    </Script>

    |-----The Link-----|

    <a href="javascript:my_win()" class="pic"><img src="images/myimage.jpg" width="540" height="120"></a>

    As you see I use an image for the link but a text link will do just fine.

    For more than one window just replicate the first part keeping it all in the <script> tags and do the same for the links.
    Hope it helps

  3. #3
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Set the focus of the popup window

    <body onLoad="self.focus()">

  4. #4
    Technically, a bit dim macdan's Avatar
    Join Date
    Feb 2001
    Location
    London
    Posts
    344
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    moospot - thanks it works a treat, I've always wanted to know how to do that.
    gorillaweb is a small London based digital design agency.

  5. #5
    SitePoint Addict
    Join Date
    Nov 2000
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    should this --- onLoad="self.focus()" --- go in the popup page or the or the page with the link?

  6. #6
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should go in the popup page.

    <body onLoad="self.focus()"> is telling the popup page to set the focus to itself (bringing in front of all other windows).

    You can also set it to go behind the other windows with <body onLoad="self.blur()">

    Hope this clears things up for you

  7. #7
    SitePoint Addict
    Join Date
    Nov 2000
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah ha! See I tried it in the popup and was thinking that it
    would remain in front of the window with the link but as soon
    as I clicked the window with the link to the popup the popup window goes behind...
    Is this meant to happen or is it meant
    to stay infront no matter what.

    This may well have something to do with the other script I am using,
    just haven't had time to change the lot so just added
    the onload bit. I will try when I get home.

    FYI found this site that is great for ppeps like me that is on
    the move or can access the web from work.
    http://web2ftp.com Like the title says it is a web site that
    gives you access to your FTP site so you can make changes
    to your pages and uploads etc.

    Nice 1 peeps

  8. #8
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In the body tag of your popu you can also place this:
    <BODY onBlur="self.focus()">

    That way the popup will be forced back to the top if you place focus on the
    main browser window.


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
  •