Java Reference
In-Depth Information
Use this code to test your Prototype installation. Open ch15_examp1_p.htm and add the second
<script/> element as shown in the following code:
<!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>Chapter 15: Example 2 Prototype</title>
<script type=”text/javascript” src=”prototype-1.6.0.3.js”></script>
<script type=”text/javascript”>
function window_onload()
{
$(document.body).writeAttribute(“bgColor”, “yellow”)
.insert(“<h1>Hello, Prototype World!</h1>”);
}
Event.observe(window, “load”, window_onload);
</script>
</head>
<body>
</body>
</html>
Save this as ch15_examp2_p.htm, and open it in your browser. You should see something like
Figure 15-2. If you do not, make sure that Prototype JavaScript fi le is in the same directory as the
HTML fi le.
Figure 15-2
Search WWH ::




Custom Search