Javascript examples for DOM Event:Element Event Attribute
onbeforeunload = myfunction();
<!DOCTYPE html> <html> <body> <a href="https://www.java2s.com">Click here</a> <script> window.onbeforeunload = function(event) { event.returnValue = "Write something clever here.."; }; </script>//from w w w .j av a 2s . c o m </body> </html>