Breaking News
yeni film izle hd film seyret film izle

Onload & Onunload Events In DHTML

Some o the frequently used events are onLoad and onunload. Onload event occurs when the current page (including all of its images) finishes loading from the server.
The onLoad event is related to the document object, and to define it you use an event handler in the tag. For example, the following is a tag that uses a simple event handler to display an alert when the page finishes loading:
<body onLoad=”alert(‘Loading complete.’)”>
Note
Since the onLoad event occurs after the HTML document has finished loading and displaying, you cannot use the document.write or document.open statements within an onLoad event handler. This would overwrite the current document.
In JavaScript 1.1 and later, images can also have an onLoad event handler. When you define an onLoad event handler for an <img> tag, it is triggered as soon as the specified image has completely loaded.
You can also specify an onUnload event for the <body> tag. This event will be triggered whenever the browser unloads the current document—this occurs when another page is loaded or when the browser window is closed.
For Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

 <head>

  <title>[Javascript:onload & onunload demo] </title>

  <meta name="generator" content="jNote-iT" />

  <meta name="author" content="eBIZ.com Pvt Ltd" />

  <meta name="keywords" content="" />

  <meta name="description" content="" />

 </head>



 <body onload="javascript:alert('eBIZ education team welcomes you');
" onunload="javascript:alert('Thnx for visiting');">

  

 </body>

</html>