D34th Maker
01-07-2012, 04:29 AM
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.
Alternative
01-07-2012, 09:53 AM
How exactly would they be closing the program? A tab close-out? If so:
<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:
<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.