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 8 of 8
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open in new window with properties

    Hi, I want to open a link in a new window with certain properties (like no buttons), I have the link details but think I need some Java to make it work, this is what I have: -

    <a href="http://sd.htm" onclick="window.open('http://sd.htm', 'SD', 'height=700,width=1000,status=0,menubar=0,scrollbars=0,resizable=1'); return false">Sales Database</A>

    Thanks in advance, if your wondering why it's so they don't use the IE forward and back buttons and use the buttons in the page other wise they don't update my DB behind the site.

    Thanks

  • #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Can't do it. You can ALWAYS go back. Just press <backspace> or right click and go back. Take this into consideration when designing your application. People want to go back. They are used to going back, sometimes forward too.

    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #3
    New Coder
    Join Date
    Apr 2005
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This how I do it.

    Code:
    function openBrWindow(theURL,winName,features) 
    {
      window.open(theURL,winName,features);
    }
    
    <a href="javascript:;"
    onClick="openBrWindow('webpage/index.html','test','status=yes,scrollbars=yes,resizable=yes,width=400,height=300')">
    Click Here</a>

  • #4
    New Coder
    Join Date
    Apr 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Not quite, errors

    I got two errors, one loading the page was

    line 9 Char 2: 'Null' is Null or not an argument

    and the second error I get when I click the link is

    line 8 Char 3: Invalid argument.

    4 <SCRIPT language=JavaScript>
    5 function openBrWindow(theURL,winName,features)
    6 {
    7 window.open(theURL,winName,features);
    8 }
    9 }
    </SCRIPT>

  • #5
    New Coder
    Join Date
    Apr 2005
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ziguana_man
    4 <SCRIPT language=JavaScript>
    5 function openBrWindow(theURL,winName,features)
    6 {
    7 window.open(theURL,winName,features);
    8 }
    9 } ---> I don't think this bracket should be inside
    </SCRIPT>
    Did you enter it accidently?

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    rather than using javascript:; in the href tag, I would use return false instead, this way if the user has javascript disabled, they can still see your page
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
    <!--
    function openBrWindow(theURL,winName,features) 
    {
    window.open(theURL,winName,features);
    }
    -->
    </script>
    </head>
    
    <body>
    <a href="webpage/index.html"
    onclick="openBrWindow('webpage/index.html','test','status=0,scrollbars=1,resizable=1,width=400,height=300');return false" target="_blank">
    Click Here</a>
    </body>
    </html>

  • #7
    New Coder
    Join Date
    Apr 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    errors still

    I got two errors, one loading the page was

    line 9 Char 2: 'Null' is Null or not an argument

    and the second error I get when I click the link is

    line 9 Char 1: invalid argument

    5 <script type="text/javascript">
    6 <!--
    7 function openBrWindow(theURL,winName,features)
    8 {
    9 window.open(theURL,winName,features);
    10 }
    -->
    </script>

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,950
    Thanks
    0
    Thanked 236 Times in 233 Posts
    For the first error, you have to show more code, the error must be in other codes. The second error invalid argument error means you're passing an invalid value for a parameter in a function. You might be passing an invalid winName value when calling openBrWindow() function. Special characters such as space, comma, etc. are not allowed (except for underscore only) in window.open targets.


  •  

    Posting Permissions

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