Javascript provides a way to add dynamically changing content to what is otherwise a static html page.   Javascript is great for adding effects such as hiding/showing elements on hover, or on click.  It is often used to generate pulldown menu's, create file uploaders, or image swaps effects.  Before you get too excited to learn pure Javascript (the base language that all browsers can interpret), you should know there there are a large number of javascript "libraries" that make most typical web tasks relatively easy to execute.  Using them correctly you can save yourself a great deal of time vs. writing pure javascript.

Four of the most popular Javascript Libraries that make light work of common tasks are:  JQuery, Prototype, Moo Tools, and DOJO.  There are several others out there as well, but these are the four I have run into most often when surfing for tutorials - i.e. they have a large enough user base that people are talking about different ways to use the libraries creatively.

It is extremely important to note that these libraries do NOT work well together.  Very often they will have function and method names that conflict.  There are ways to get around this occassionally, but it would likely be in your best interest to use only one library exclusively for any particular website.  This is particularly true if you are using a framework like Ruby-On-Rails that uses a global layout.

In addition to those javascript libraries, there are many "effect add-ons" that utilize one of the above stated libraries to make very cool effects (such as making images fade-up-and-out). These effect add-ons are dependant on the library you have selected to use.  For instance, the "script.aculo.us" effects add-on is built off of the Prototype javascript library.  If you have included the JQuery library instead, none of the script.aculo.us effects will works (or they may somewhat work, with wierd and inconsistant behavior).

Lastly, if you are using Ruby-On-Rails, you should note that Prototype is the default library.  Using other libraries is possible, but takes a little work and understanding beyond this article.

A good source to see all of the available javascript libraries and other add-ons is http://javascriptlibraries.com/



 

Add your comment

Your name:
Your email:
Your website:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification: