Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
What is the usage of onunload event in JavaScript?
The unload event trigger when you unload (or refresh) a page. You can try to run the following code to learn how to implement onunload event in JavaScript.
Example
<!DOCTYPE html>
<html>
<body onunload="newFunc()">
<p>Close the page and see what happens!</p>
<p>This event may give unexpected results.</p>
<script>
function newFunc() {
alert("Thank you!");
}
</script>
</body>
</html> Advertisements
