Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I need a popup that will work consistently

    I am using a javascript to open a popup window from a link:

    <!-- Begin
    function openpopup(){
    var popurl="http://nancyslaneinteriordesign.com/main.htm"
    winpops=window.open(popurl,"","width=990,height=486,")
    }
    // End -->

    <a href="javascriptpenpopup()">


    I just want it to pop up in the top left hand corner, but it pops up in different places on different computers. Where can I find a javascript that will be consistant on all broswers and computers?

  • #2
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,743
    Thanks
    0
    Thanked 244 Times in 239 Posts
    Hi there pacothelovetaco,

    and a warm welcome ti these forums

    Add top=0,left=0, to this line thus.....

    winpops=window.open(popurl,"","width=990,height=486,top=0,left=0")

    ....then adjust these values to suit your needs

    coothead

  • #3
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    First off thank you for the welcome. It was much appreciated. Second thank you for you help. That is all I needed.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You may want to make the function more generic so you can use it in multiple links.

    function openpopup(popurl){
    var winpop=window.open(popurl,"","width=990,height=486,top=0,left=0");
    winpop.focus();
    return false; //cancels href
    }
    ...
    <a href="main.htm" onclick="return openpopup(this.href)">main</a>
    <a href="sub.htm" onclick="return openpopup(this.href)">sub</a>
    ...

    Doing it this way enables your page to still be opened even if javascript is disabled.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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