English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Wenn die Seite geschlossen wird, wird das unload-Ereignis ausgelöst.
Führen Sie JavaScript aus, wenn das Dokument vom Benutzer deinstalliert wird:
!DOCTYPE html> <html> <meta charset="utf-8"> <title>Grundausbildung(oldtoolbag.com)</title> <head> <script> function say_goodbye() { alert("Vielen Dank, dass Sie die Grundausbildung besucht haben(oldtoolbag.com)。 } </script> </head> <body onunload="say_goodbye()"> <h1>Welcome to my homepage</h1> <p>Closing the window or pressing F5 Refresh the page.</p> </body> </html>Test it out ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the onunload event attribute
The onunload attribute is triggered after the page (or browser window) is unloaded.
onunload occurs when the user navigates away from the page (by clicking a link, submitting a form, closing the browser window, etc.).
Note: If the page is reloaded, the onunload event (and onload event) will also be triggered.
No difference.
<element onunload="script">
Value | Description |
---|---|
script | Specifies the script to be executed when the onunload event is triggered. |