www.webdeveloper.com
Results 1 to 7 of 7

Thread: window properties

  1. #1
    Join Date
    Dec 2002
    Location
    australia
    Posts
    13

    Question window properties

    hey there. just had a quickie.

    I want to open a new window without all the crap directories, status bar, scrollbars, etc. (it's linked to a picture you click on). I'd like to not use java if i can avoid it, so i thought id ask you guys - i gave it a shot, but obviously screwed it up, cos it won't work.

    So i'd really, truly apprectiate the whole code written out if it's not a massive hassle... i just need the obvious pointed out )
    ariana

  2. #2
    Join Date
    Nov 2002
    Posts
    631
    You can't open a window with just HTML. You have to do it with JavaScript. If you don't want all the window properties, make you window script like this:

    <script language="JavaScript" type="text/JavaScript">
    <!-- Begin

    function newWindow() {
    newWin = window.open("","Your windows title","width=whatever,height=whatever,scrollbars=no,menubar=no,status=no,toolbar=no,resizable=no");
    newWin.document.write("Your new Windows contents");
    newWin.focus();
    }

    // End -->
    </script>

    <a href="javascript:newWindow();">Open New Window</a>

    That will give you a window without all the menu's added to it and stuff.

  3. #3
    Join Date
    Nov 2002
    Posts
    984
    Originally posted by Zach Elfers
    <a href="javascript:newWindow();">Open New Window</a>
    That code breaks the link if JS is not available, not to mention that it is incorrect JavaScript.

    Try
    <a href="imagelocation" target="_blank" onclick="newWindow(); return false;">Open New Window</a>

    That will make it work in all browsers at least partially.
    // Stefan Huszics

  4. #4
    Join Date
    Dec 2002
    Location
    australia
    Posts
    13

    Angry still stuck =/

    hey hey ther. thanks for helping me out. i dont know what the flop i'm doing wrong, but it wont even open a new window now.

    would you mind having a look at my page for me??

    http://www.geocities.com/aribanana/leslie/theband.htm

    just that pic you click on is meant to open a new window with none of the scrollbar toolbar crap - but i've stuffed it up somehow. : o(
    ariana

  5. #5
    Join Date
    Nov 2002
    Posts
    631
    That space in between the java and script (java script) is an error. I don't know what's happening. I went to edit that thinking it was a mistake I made but the words were together and it still appeared that way. When you write your code take the space out.

  6. #6
    Join Date
    Nov 2002
    Posts
    984
    Originally posted by Zach Elfers
    That space in between the java and script (java script) is an error.
    No the error is to use that Javascript: AT ALL. It's neighter needed nor correct.

    This works as it should, girl. It's possible that other broken stuff on your page messes something up.
    So start with this code example and add the rest of your page to it.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <title>JS popup</title>
    <script type="text/javascript">
    function newWindow() {
    window.open('test.html','winname','toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directo ries=no,resizable=no,width=640,height=480');
    }
    </script>
    </head>
    <body>

    <a href="test.html" target="_blank" onclick="newWindow();return false;">Open New Window</a>

    </body>
    </html>
    Last edited by Stefan; 12-02-2002 at 06:15 AM.
    // Stefan Huszics

  7. #7
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Let me just add that if you specify any part of the window geometry, say height and width, then the other parts default to 'no'. You never need to write toolbar=no. See http://developer.netscape.com/docs/m...ow.htm#1202731 for window geometry deails.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles