JavaScript
  Home arrow JavaScript arrow Introducing the Behaviour JavaScript Libra...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Introducing the Behaviour JavaScript Library
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 7
    2007-03-19

    Table of Contents:
  • Introducing the Behaviour JavaScript Library
  • A basic example
  • Expanding the application range of the Behavior package
  • Applying rules to a different CSS selector

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Introducing the Behaviour JavaScript Library


    (Page 1 of 4 )

    Separating the layers of your web pages makes them more compact and easier to maintain. The Behaviour JavaScript library makes it easy for even beginning coders to do this, and helps seasoned developers save time when building web sites. This article is the first in a three-part series that explains the features of this library.

    To speak frankly, the Web still contains thousands of web sites that have been poorly developed. Many of them include amateur graphics, implement limited or nonexistent accessibility and usability, and so forth. This becomes even more evident when you take a quick look at their rendered source code.

    One of the most critical issues of these web sites is the way that JavaScript code is integrated into the corresponding structural markup. Examining the client-side code of this kind of web site can be a painful experience. There are many messy, inline JavaScript handlers here and there, mixed up with (X)HTML code. And then of course, there is the weak structure of the markup in question. All of these factors speak for themselves about how poorly the pages have been created and designed.

    On today's Web the above scenario seems to be unfortunately quite popular. But if you're a conscientious web developer, then you know the importance of building web sites where each one of the layers -- that is, the sections corresponding to visual presentation, behavior and structure respectively -- are completely isolated from each other. This is the best approach to take to keep these web sites compact and highly maintainable.

    However, you may be a beginner that still mixes up inline JavaScript event handlers with the structural markup of your web sites, simply because you don't know that these two classes of elements should reside in different layers. So, bearing in mind this eventual possibility, in this three-part series I'm going to show you how to avoid including the aforementioned inline JavaScript handlers by using a compact, tight JavaScript library called "Behaviour."

    The Behaviour package has been created by Ben Nolan (please visit http://www.bennolan.com/behaviour/ for more information). It boasts a bunch of remarkable features which will let you separate the (X)HTML and JavaScript code corresponding to your web site very easily. It's particularly useful when it comes to assigning event handlers to one or more elements of different web documents.

    Having introduced the main characteristics that this powerful JavaScript package offers, now let's move on and start learning together how to take advantage of its numerous and handy features. Let's begin now!

    More JavaScript Articles
    More By Alejandro Gervasio


       · As you'll learn in this first article of the series, the Behaviour JavaScript...
     

    JAVASCRIPT ARTICLES

    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget
    - Ajax Hack for Entering Information Without R...
    - EXT JS 2.1 Overview
    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables
    - Assigning Background Colors Dynamically to Z...
    - Building Zebra Tables with CSS and JavaScript
    - JavaScript: Array Objects
    - A Closer Look at Smart Markers with Yahoo! M...
    - Using Polylines and Smart Markers with Yahoo...
    - Bulleted Menu of Links
    - Creating Click Loggers and Basic Markers wit...
    - Adding Pan Controls to Yahoo! Maps







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway