View Single Post
02-17-2008, 06:21 AM
Join Date: Dec 2007
Originally Posted by
Yes Orc, prototype is one of the many JS libraries that work with a syntax like that.
For instance, if you need to get the value of a form field you could do it like this:
var x = document.getElementById("field_id").value;
With prototype you can do this by typing:
var x = $F("field_id");
Ultimately, prototype will simply "forward" your call to document.getElementById("..").value. But since it is a cross-browser library it will also do some browser checks and if it can't retrieve the value using document.getElementById("..").value it will use another method. Prototype frees you from doing this dirty work of browser checks and stuff like that, it also let's you write smaller and cleaner code. On the other hand, prototype is over 100k in size, keep in mind that it will be included in your pages and your visitors browser will have to download it, the good news is that the browser will probably cache it.. so you don't need to worry about it slowing the page loading time. Check the
for more info.
Other libraries (like
) also use the $() syntax. In jQuery you can use regular expressions and a lot of other stuff inside the $() that allows you to select and apply effects to various DOM elements at the same time, it's an interesting library too.
jQuery sounds fun. :D
VillageIdiot can have my babbies ;d
View Public Profile
Send a private message to Orc
Visit Orc's homepage!
Find More Posts by Orc