JAVASCRIPT

 Home  Computers & Internet  Web Programming JAVASCRIPT
What is Javascript?
Javascript Placement
Syntax
Reserved Words
Variables
Data Types
Escaping Characters
Concatenation
Arithmetic Operators
Assignment Operators
Comparison Operators
Boolean Operators
Conditional Operator
If Statements
Else If Statements
If Else Statements
Switch Statements
While Loops
For Loops
Do While Loops
Break Statement
Continue Statement
prompt()
alert()
Date()
Event Handlers
String Object Methods
Math Object Methods
Window Object Methods
Arrays

JAVASCRIPT ONUNLOAD EVENT

The javascript onunload event handler is used to trigger a script when the page unloads ie. when you close or browse away from a page. The onunload event calls the action from the <body> or <frameset> tags:

Example:

<body onunload="alert('Please don\'t go');">

The above example will output Please don't go as you try to close the page or browse away.

The onunload event can also call a function as follows:

<head>
<script type="text/javascript">

function dontGo()
{
alert('Please don\'t go');
}

</script>
</head>

<body onunload="dontGo();">

See also:

onload
onclick
ondblclick
onmousedown
onmouseup
onmouseover
onmousemove
onmouseout
onkeypress
onkeydown
onkeyup
onfocus
onblur
onsubmit
onreset
onselect
onchange


Home | Privacy Policy | Terms Of Use | Contact Us