JavaScript DHTML/HTML/Body

Материал из Web эксперт
Перейти к: навигация, поиск

Body on click event

   <source lang="html4strict">
 

<html> <head> <title>A Simple Page</title> <script language="JavaScript"> function yourMessage() {

   alert("Your first function!");

} </script> </head> <body onClick="yourMessage()"> </body> </html>


 </source>
   
  


Body onload event

   <source lang="html4strict">
 

<html> <head> <title>A Simple Page</title> <script language="JavaScript"> function yourMessage() {

   alert("Your first function!");

} </script> </head> <body onLoad="yourMessage()"> </body> </html>


 </source>
   
  


Body on stop event

   <source lang="html4strict">
 

<html> <head> <title>A Simple Page</title> <script language="JavaScript"> function stopped() {

   alert("don"t go");

} </script> </head> <body onstop="stopped()"> </body> </html>


 </source>
   
  


Running a Script from the body onload Event Handler

   <source lang="html4strict">
 

<html> <head> <title>An onload script</title> <script type="text/javascript"> function done() {

   alert("The page has finished loading."); 

} </script> </head> <body onload="done()"> Here is some body text. </body> </html>


 </source>