#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    390
    Rep Power
    13

    Popup windows with url vs function


    Im getting strange behavior if I use javascript url compared to having hte same window.open method called from a function.

    <a href="javascript: openwindow()">Privacy Notice</a>
    Code:
    <SCRIPT language="JavaScript1.2">
    function openwindow()
    {
    	window.open("special_notice.htm","mywindow","menubar=1,resizable=1,width=450,height=550");
    }
    </SCRIPT>

    Now if I use the following, I get weird behavior. The popup will display, but the main window will blank out.
    Code:
    <a href="javascript:window.open('special_notice.htm','mywindow','menubar=1,resizable=1,width=450,height=550')">US Privacy Notice</a>
  2. #2
  3. Cunning Linguist
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2003
    Location
    I used to live at home, now I stay at the house
    Posts
    10,180
    Rep Power
    2039
    Do something like this:
    Code:
    <a href="special_notice.htm" onclick="return !window.open(this.href, 'mywindow', 'menubar=1,resizable=1,width=450,height=550');">link</a>

    Comments on this post

    • JavaReb agrees : thanks a bunch!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    390
    Rep Power
    13

    Thumbs up


    Yes, thank you, that works

IMN logo majestic logo threadwatch logo seochat tools logo