+3

An example of onload and unonload event listener

Event handling

4/5/2019 8:46:09 PM

¿ ?

1 Answer

New Answer

+6

var userName = ""; function promptName() { userName = prompt("What's your name ?", "") return userName; } function goodBye() { alert("Goodbye, " + userName + "!"); } window.onload=promptName(); window.onbeforeunload = goodBye();