Results 1 to 5 of 5

Thread: What's the JS code for closing a window....?

  1. #1
    tralalala's Avatar The Almighty
    Join Date
    May 2003
    Posts
    5,437
    Well, I am maintaining a website, and I need some help...

    What is the JS code for closing a window?

    As in, at the top of the page there will be a link "Close Window". and when you click... it closes the window..


    Can anyone help me out here?

    Thanks,
    Rafi

  2. Internet, Programming and Graphics   -   #2
    Retired
    Join Date
    Feb 2003
    Posts
    12,488
    <form method="post">
    <input type="button" value="Close Window"
    onclick="window.close()">
    </form>


    (does not work in Firefox)

  3. Internet, Programming and Graphics   -   #3
    tralalala's Avatar The Almighty
    Join Date
    May 2003
    Posts
    5,437
    Thanks

    Could you also please tell me what the code is for going back (as in like clicking on the back button in the browser, but a button that says "Back" on it..)


    Thanks a lot!!

  4. Internet, Programming and Graphics   -   #4
    I just use this link for that:
    Code:
    <a href="javascript:history.go(-1)">
    There's probably a better way of doing it tho.

  5. Internet, Programming and Graphics   -   #5
    Retired
    Join Date
    Feb 2003
    Posts
    12,488
    <form>
    <input type="button" VALUE="Go back" onClick="history.go(-1)">
    </form>
    Last edited by {I}{K}{E}; 07-28-2005 at 06:32 PM.

Bookmarks

Posting Permissions

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