JavaScript Event Handlers :Loading/ Unloading a Document : HTML Body Event : HTML : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
C++
PHP
JavaScript DHTML Home »  HTML   » [  HTML Body Event  ]   
 



JavaScript Event Handlers :Loading/ Unloading a Document

Please note that some example is only working under IE or Firefox.


/*
JavaScript Unleashed, Third Edition
by Richard Wagner and R. Allen Wyke 

ISBN: 067231763X
Publisher Sams CopyRight 2000

*/


<html>
<head>
<title>Load/Unload Example</title>
   
<script language="JavaScript">
<!--
   
   var noticeWindow
   
//onLoad event handler
function checkBrowser() {
if ((navigator.appName == 'Netscape') &&
   (navigator.appVersion == '4.(Win95; I)')) {
noticeWindow = window.open("""NoticeWindow",
        "toolbar=0,width=300,height=100,resizable=0");
     noticeWindow.document.write("<HEAD><TITLE>Upgrade Notice</TITLE></HEAD>");     noticeWindow.document.write("<CENTER><BIG><B>Your Web Browser needs to be updated. Please see your supervisor before noon.
      </B></BIG></CENTER>")}
}
   
// onUnload event handler
  function clean() {
    if noticeWindow != null ) { noticeWindow.close() };
  }
// -->
</script>
</head>
<body onLoad="checkBrowser()" onUnload="clean()">
<font color="#008000">
<center><big><b>Intranet Home Page</b></big></center>
</body>
</html>

           
       
Related examples in the same category
1.  Using the fireEvent() Method
2.   onBlur and onFocus Event Handlers
3.  Using the onSelectStart Event Handler
4.  Calling to Display the Alert Dialog onLoad
5.  Calling to Display the Alert Dialog Directly
6.  Handling Load Events in a Content Document
7.  Using Event Bubbling with the onClick Event
8.   Running a Script from the onLoad Event Handler
9.  Using addBehavior() and removeBehavior()
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.