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 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    53
    Thanks
    0
    Thanked 3 Times in 3 Posts

    How can i make a msgbox appear when the user closes the program.

    Hey codingforums members im wondering what would be the code to have a msgbox appear when the user closes the program and have it close after 3 seconds to 7 seconds.

    If you need my current code just say and ill add it in to this topic.

  • #2
    New Coder
    Join Date
    Jan 2012
    Location
    RI, USA
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts
    How exactly would they be closing the program? A tab close-out? If so:

    Code:
    <script type="text/javascript">
    farewell = function() {
        alert("Thank you for using this program!");
    }
    </script>
    ^Put this in your <head> tag.

    After that, add this into your HTML body tag:

    Code:
    <body onunload="farewell()">
    Javascript is likely the best solution for this feature, although we could use a few more details about what you want to do. Forcing somebody to stare at the goodbye message for 3-7 seconds before the tab closes isn't a good idea in my opinion - a simple goodbye popup that can be Xed out of would work better if you ask me.


  •  

    Posting Permissions

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