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 12 of 12
  1. #1
    Regular Coder
    Join Date
    Jan 2004
    Location
    Georgia
    Posts
    306
    Thanks
    0
    Thanked 0 Times in 0 Posts

    open child window

    what might be wrong with this?



    Code:
    <script language="javascript">
    function popUp(url)
    {
    window.open(url,'new_win','height=180,width=200','scrollbars=yes,toolbar=no,resizable=no,menubar=no,directories=no')
    }
    </script>
    ~Designer's Toolz~

  • #2
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: open child window

    window.open(url,'new_win','height=180,width=200 ',' scrollbars=yes,toolbar=no,resizable=no,menubar=no,directories=no');

    The bold, red part is wrong with that. Change to a single comma, and you should be good to go.


    edit: tags? the hell?
    Last edited by Choopernickel; 03-19-2004 at 09:39 PM.

  • #3
    Regular Coder
    Join Date
    Jan 2004
    Location
    Georgia
    Posts
    306
    Thanks
    0
    Thanked 0 Times in 0 Posts
    that doesnt make a difference. I dont even see a difference in my code and whatever you said was wrong.
    ~Designer's Toolz~

  • #4
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    nothing is wrong.

    <script language="javascript">
    function popUp(url)
    {
    window.open(url,'new_win','height=180,width=200','scrollbars=yes,toolbar=no,resizable=no,menubar=no, directories=no')
    }
    popUp("http://www.google.com")
    </script>

  • #5
    Regular Coder
    Join Date
    Dec 2003
    Location
    USA
    Posts
    230
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Actually, there is something wrong, as Choopernickle pointed out.

    The open(); method of the Window object takes four optional arguments.
    The first argument is the URL of the page to be displayed in the new window.
    The second argument is the name of the window.
    The third argument is a list of features that specify the window size and GUI decorations.
    The fourth is a boolean value that specifies whether the URL specified as the first argument should replace the current entry in the window's browsing history, or create a new entry. This is only useful if the second argument names a window that already exists.

    Basically: you have incorrectly split up the third argument (list of features) into two separate arguments. Remove the apostrphes (') as Choopernickle said, and you'll be good to go.
    Last edited by Paul Jr; 03-20-2004 at 04:17 PM.

  • #6
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In addition to the problem Choopernickel pointed out.
    Your script is broke across several lines.
    ( Lines 4, 5 and 6 should be one line)

    Code:
    1: <script language="javascript">
    2: function popUp(url)
    3: {
    4: window. open(url,'new_win','height=180,width=200','scrollb
    5:  ars=yes,toolbar=no,resizable=no,menubar=no,directo
    6: ries=no')
    7: }
    8: </script>
    .....Willy

  • #7
    Super Moderator sage45's Avatar
    Join Date
    May 2002
    Posts
    1,060
    Thanks
    0
    Thanked 13 Times in 13 Posts
    In other words, this:
    Code:
    <script language="javascript">
    function popUp(url)
    {
    window. open(url,'new_win','height=180,width=200','scrollb
     ars=yes,toolbar=no,resizable=no,menubar=no,directo
    ries=no')
    }
    </script>
    Should be this:
    Code:
    <script language="javascript">
    function popUp(url)
    {
    window.open(url,'new_win','height=180,width=200,scrollbars=yes,toolbar=no,resizable=no,menubar=no,directories=no')
    }
    </script>
    With no line breaks.
    HTH,

    -sage-
    HTML & CSS Forum Moderator

    "If you don't know what you think you know, then what do you know."
    R.I.P. Derrick Thomas #58
    1/1/1967 - 2/8/2000

  • #8
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The forum broke the script again.
    Code:
    1: <script language="javascript">
    2: function popUp(url)
    3: {
    4: window. open(url,'new_win','height=180,width=200,scrollbar
    5:  s=yes,toolbar=no,resizable=no,menubar=no,directori
    6: es=no')
    7: }
    8: </script>
    Try this:


    <script type="text/javascript">
    function popUp(url){
    window.open(url,'new_win','height=180,width=200,scrollbars=yes,toolbar=no,resizable=no,menubar=no,di rectories=no')
    }
    </script>


    .....Willy

    Edit: The forum is still breaking the script.
    Last edited by Willy Duitt; 03-20-2004 at 05:59 PM.

  • #9
    Regular Coder
    Join Date
    Jan 2004
    Location
    Georgia
    Posts
    306
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In other words, this:
    code:--------------------------------------------------------------------------------<script language="javascript">
    function popUp(url)
    {
    window. open(url,'new_win','height=180,width=200','scrollb

    ars=yes,toolbar=no,resizable=no,menubar=no,directo

    ries=no')
    }
    </script>--------------------------------------------------------------------------------
    Should be this:
    code:--------------------------------------------------------------------------------<script language="javascript">
    function popUp(url)
    {
    window. open(url,'new_win','height=180,width=200,scrollbar
    s=yes,toolbar=no,resizable=no,menubar=no,directori
    es=no')
    }
    </script>--------------------------------------------------------------------------------
    With no line breaks.
    HTH,

    Nope, still doesnt work. The problem with the orginal was it worked in IE but not mozilla. That code doesnt work in either. This is what I'm using to call the script:

    Code:
    <a href="#"onclick="popUp('/pages/changetheme.php')";>Change theme</a>
    ~Designer's Toolz~

  • #10
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Perhaps this will help,

    The correct paramaters for window.open:

    Code:
    var popper=window.open('URL','WindowName','Property1,Property2');
    Add as many window properties as you wish seperated by commas.

    The previous code works you just need to take out the line breaks.

    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #11
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As Basscyst pointed out.
    The previously posted script does work but the forum software is breaking the script by adding line breaks because the window.open(...) string is too long.

    Try this:
    Code:
    <script type="text/javascript">
    function popUp(url){
    features = 'height=180,width=200,';
    features+= 'scrollbars=yes,toolbar=no,';
    features+= 'resizable=no,menubar=no,';
    features+= 'directories=no';
    window.open(url,'new_win',features)
    }
    </script>
    <a href="http://google.com" onclick="popUp(href);return false">Google</a>
    .....Willy

  • #12
    Regular Coder
    Join Date
    Jan 2004
    Location
    Georgia
    Posts
    306
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think I should know that it needs to be on one line C'mon, Ive been a programmer of 5 languages for years. I got this thing worked out now. Thanks Ya'll
    ~Designer's Toolz~


  •  

    Posting Permissions

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