What difference between unload and onload?
Answers
Answered by
0
Consider the following HTML snippet containing some javascript utilizing prompt and unload. The prompt() method works fine but I want alerting something like Goodbye, user when reloading or leaving the page. Any help is greatly appreciated.
<body onload="promptName()" > <script type="text/javascript"> function promptName() { var userName = prompt("What's your name ?", "") return userName; } function goodBye() { alert("Goodbye, " + promptName() + "!"); } window.onunload = goodBye(); </script> </body>i know about onload only it is a java script commd
Similar questions