SoFunction
Updated on 2025-04-13

Prototype latest version (1.5 rc2) User Guide (1)

Before writing this guide, let me introduce what Prototype is mainly used for. If you pay more attention to the application of ajax/javascipt, you should have heard of this javascript framework. Prototype is a basic javascript application framework. Let’s first quote an introduction from the official website.

Prototype is a JavaScript framework that aims to ease development of dynamic web applications. Featuring a unique, easy-to-use toolkit for class-driven development and the nicest Ajax library around, Prototype is quickly becoming the codebase of choice for web application developers everywhere.

According to the author's own introduction, the purpose of Prototype is to more conveniently develop JavaScript applications. Using it can use JavaScript to program more conveniently and simply develop object-oriented JavaScript programs. Prototype contains a powerful and easy-to-use ajax framework. Prototype is a basic framework, and many higher-level frameworks are based on it. For example, the scripttaculous effect library Prototype contains the following parts:

base: The basic functions applied in Prototype, basically all other parts rely on it, including sum for object-oriented styles, a Try object, function binding, number extension, PeriodicalExecuter (the function that periodically executes a certain function), etc.
string: Extending the String prototype, adding strip, escapeHTML and other useful methods to string.
enumerable: The parent class object of enumeration type (array, hash, range, etc.), provides a common method of enumeration type
array: The extension of the Array prototype has added indexOf, without and other methods to array
hash: Provides a easy and easy Hash implementation for javascript
range: Inherited from enumerable, a scope (for example, 3---67) object
ajax: A powerful and easy-to-use ajax framework
dom: Provides a good cross-browser packaging for browser-based development and adds many powerful functions.
selector: provides the function of selecting elements using class, css, etc.
form: Some functions of forms
event: Simple exaggeration of platform event encapsulation
position: Provides some functions regarding element position

It can be said that Prototype just wants a Swiss army knife, which encapsulates many general functions for JavaScript, greatly simplifies the development of JavaScript applications, and adds great confidence to JavaScript developers. Prototype can run the platform, and no longer worry about various cross-platform issues using it. * Microsoft Internet Explorer for Windows, version 6.0 and higher * Mozilla Firefox 1.0/Mozilla 1.7 and h igher * Apple Safari 1.2 and higher However, it should be noted: If you want to understand Prototype well, you should first understand some knowledge of object-oriented development of JavaScript. Future articles will give a detailed introduction to the methods in each specific function in Prototype, including functions, examples, etc. Prototype official website: / , the current release version is only 1.4, but 1.5 has undergone great changes now, and many libraries based on prototype use 1.5, so it is highly recommended to download the latest version of the code through svn.