An example where you create an object in the body (markup) and, when the page loads, that object's corresponding function is triggered
|
|
<!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" xml:lang="ko" lang="ko"> |
|
|
|
|
|
<head> |
|
|
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> |
|
|
<title>Window Object Events & Event Handlers 2</title> |
|
|
|
|
|
<meta name="Keywords" content="" /> |
|
|
<meta name="Description" content="" /> |
|
|
|
|
|
<script type="text/javascript"> |
|
|
//<![CDATA[ |
|
|
// blur , focus , change , click , error , load , unload , keyup , keydown , submit , reset , resize ..etc |
|
|
|
|
|
function text(){ |
|
|
alert("Thanks for stopping by.."); |
|
|
} |
|
|
|
|
|
//]]]]]]> |
|
|
</script> |
|
|
|
|
|
</head> |
|
|
|
|
|
<body onload="text();"> |
|
|
</body> |
|
|
|
|
|
</html> |
