JavaScript DHTML/HTML/Body

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

Body on click event

  
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
function yourMessage()
{
    alert("Your first function!");
}
</script>
</head>
<body onClick="yourMessage()">
</body>
</html>



Body onload event

  
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
function yourMessage()
{
    alert("Your first function!");
}
</script>
</head>
<body onLoad="yourMessage()">
</body>
</html>



Body on stop event

  
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
function stopped()
{
    alert("don"t go");
}
</script>
</head>
<body onstop="stopped()">
</body>
</html>



Running a Script from the body onload Event Handler

  
<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>