spacer.png, 0 kB
spacer.png, 0 kB
Home arrow Javascript arrow Prototype and Script.aculo.us arrow Prototype: a simple example
Prototype: a simple example PDF Print E-mail
Written by Administrator   
sabato, 11 ottobre 2008

To load Prototype into the page environment, you need to include a script tag. With the line of the following example you will be able to utilize the potential functions of this framework.
You can download Prototype from this link: http://prototypejs.org/.

Here below a web page with Prototype

<!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="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <script type="text/javascript" src="prototype.js"></script>
  <title>Blank Page</title>
</head>

<body>
  <h1>Blank Page</h1>
</body>
</html>

The Prototype library defines a global object called Prototype, which holds metadata about the library itself. Here below a simple script showing the best way to determine whether the Prototype library has been loaded into a page.


// raise an error if Prototype isn't loaded
if (typeof Prototype === "undefined") {
throw new Error("This script relies on the Prototype JavaScript framework.");
}

Last Updated ( sabato, 11 ottobre 2008 )
 
< Prev
spacer.png, 0 kB
spacer.png, 0 kB
spacer.png, 0 kB