- Prototype - Periodical Execution
- Prototype - Expressing Ranges
- Prototype - AJAX Support
- Prototype - JSON Support
- Prototype - Form Management
- Prototype - Event Handling
- Prototype - Enumerating
- Prototype - Templating
- Prototype - Basic Object
- Prototype - Hash processing
- Prototype - Array Processing
- Prototype - Strings Processing
- Prototype - Number Processing
- Prototype - Element Object
- Prototype - Utility Methods
- Prototype - Useful Features
- Prototype - Short Overview
- Prototype - Home
Prototype Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Prototype - Overview
What is Prototype ?
Prototype is a JavaScript Framework that aims to ease the development of dynamic web apppcations. Prototype was developed by Sam Stephenson.
Prototype is a JavaScript pbrary, which enables you to manipulate DOM in a very easy and fun way that is also safe (cross-browser).
Scriptaculous and other pbraries, such as Rico are build on Prototype s foundations to create widgets and other end-user stuff.
Prototype −
Extends DOM elements and built-in types with useful methods.
Has built-in support for class-style OOP including inheritance.
Has advanced support for event management.
Has powerful Ajax features.
Is not a complete apppcation development framework.
Does not provide widgets or a full set of standard algorithms or I/O systems.
How to Install Prototype?
Prototype is distributed as a single file called prototype.js. Follow the below mentioned steps to setup the prototype pbrary −
Go to the download page
to grab the latest version in a convenient package.Now, put prototype.js file in a directory of your website, e.g. /javascript.
You are now ready to use the powerful Prototype framework in your web pages.
How to Use Prototype Library?
Now, you can include the Prototype script as follows −
<html> <head> <title>Prototype examples</title> <script type = "text/javascript" src = "/javascript/prototype.js"></script> </head> <body> ........ </body> </html>
Example
Here is a simple example showing how you can use Prototype s $() function to get DOM elements in your JavaScript −
<html> <head> <title>Prototype examples</title> <script type = "text/javascript" src = "/javascript/prototype.js"></script> <script> function test() { node = $("firstDiv"); alert(node.innerHTML); } </script> </head> <body> <span id = "firstDiv"> <p>This is first paragraph</p> </span> <span id = "secondDiv"> <p>This is another paragraph</p> </span> <input type = "button" value = "Test $()" oncpck = "test();"/> </body> </html>
Output
Why This Tutorial?
A very good documentation for Prototype Framework is available at
then why should one refer to this tutorial!The answer is that we have put all the most commonly used functionapties together in this tutorial. Secondly, we have explained all the useful methods along with suitable examples, which are not available at the official site.
If you are an advanced user of Prototype Framework, then you can directly jump to the official website, otherwise this tutorial could be a good start for you and you can use it pke a reference manual.
Advertisements