Archive Forums (lite version).  Gaming, Game Development, and Anime community!


PDA

View Full Version : Prototype Javascipt Library


Snif
12-30-2006, 06:36 PM
Did you know that javascript can be manipulated and turned into an object based language? Well you do now. To do this I use the prototype (http://prototype.conio.net/) javascript library. To just use the Object based part you do not need the entire library. I made a file called prototype.lite.js which was based on the moo.fx prototype.lite.js. The modifications I made was the adding of a few more functions from protype and added 3 shortcut functions of my own design. These shortcuts are :
// Sets innerHTML
$I = function(elem, inner){ $(elem).innerHTML=inner; }
// Appends innerHTML
$IA = function(elem, inner){ $(elem).innerHTML+=inner; }
// Returns style
$S = function(elem){ return $(elem).style; }

My customized version of prototype.lite.js can be viewed here (http://kniffenwebdesign.com/prototype.lite.js).

I will be posting some of my own javascript classes soon. :)

Google
--

Walrii
01-02-2007, 11:25 AM
That's pretty neat, though pretty much a hack of the language :)

darkfire
01-02-2007, 11:47 AM
The Prototype is popular for AJAX. I've been using it heavily in my development of may new site. (It won't go live for a few months.)
RubyonRails comes with that libary its really useful. You can use it to substiutle div layers in html for dynamically changing content without the need to refresh the page. Something that I think would come in hand for DevJournal.