Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Response to Close Window

    I know very little about HTML/Java and etc. but would like to have a blank page open and close. So far I have:

    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript"></SCRIPT>
    window.close();
    //--></SCRIPT>
    </HEAD>

    <BODY>

    </BODY>
    </HTML>


    The end result is a prompt asking if I really want to close the window. Is it possible to respond "YES" to the prompt within the code?

    Thanks,
    John

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Response to Close Window

    Try this:<pre><HTML>
    <head>
    <script language=javascript>
    < ! --
    function closeme() {
    window.close();

    }
    // -- >
    </script>
    </head>
    <body onload="java script:closeme()">
    </body>
    </HTML></pre>

    HTH <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Response to Close Window

    When you post HTML that contains comment tags, the Lounge software deletes the "comment." You need to "break" the tags (as illustrated in MarkJ's response) in order to post it. I mention this because I think something rather critical probably is missing from your post: You have two closing </SCRIPT> tags and only one <SCRIPT> tag.

  4. #4
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Response to Close Window

    Mark,

    Thanks for the suggestion. Unfortunately the window remains open.

    John

  5. #5
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Response to Close Window

    How are you opening the window? I've noticed that if you try to close a window that's already open, IE will prompt you with a confirm message (like: "A script is trying to close this window...is this ok?").

    If the window has been opened with a script, it usually doesn't mind closing with one.

    HTH

  6. #6
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Response to Close Window

    Check this script at The JavaScript Source - it may give you some ideas.

Posting Permissions

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