Attention SunRocket Customers !! Get latest updates and offers on VOIP Phone Service Hot Offer !!
AJAX IMPACT

Amazon Secrets

Recommended Books
Ajax in Action

Professional Ajax

Head Rush Ajax

Ajax Patterns and Best Practices

Pragmatic Ajax

Foundations of Atlas

Foundations of Ajax

Add to Technorati Favorites

TUTORIALS
Metaprogramming JavaScript Tutorial - Part 1
03/30/2007 By Adam McCrea

Lingo


Last week, I gave a presentation at the Columbus Ruby Brigade meeting about metaprogramming JavaScript. Although I posted that presentation here, the slides were short on text, so I thought it would be more helpful if I wrote a series of tutorials to discuss these concepts. Also, I want to take my example a bit further with more extensions and refactoring.

But before we dive into what metaprogramming is, why it is important, and how we can bring it to life in JavaScript, let’s start with an example that we can build on throughout the tutorial: Say we’ve got a really basic form with select boxes for country and state, and we have a requirement to only show the state when the selected country is “United States”.



This code works just fine, and there is certainly nothing wrong with it for such a simple requirement. Unfortunately, things get hairy as requirements change. Let’s see how our code scales when we want to do the following:

  • add province field

  • show province when country is “Canada”

  • show state when country is “United States”

  • show Brutus when state is “Ohio” or “Michigan”

       Read Full Tutorial ...

     Rate this Ajax Tutorials
     Rating: 9.0 out of 86 votes cast

    AJAX NEWS
    04/01/2007 wxJavaScript : porting wxWidgets to JavaScript.
    03/31/2007 DED|Chain - The web developers JavaScript Kit
    03/30/2007 Clipperz Crypto Library - a JavaScript library of crypto primitives
    03/28/2007 ETech - AJAX Unplugged Slides
    03/27/2007 Stripe Generator: ajax powered web 2.0 tool!
    03/26/2007 Finally Microsoft joins the OpenAjax Alliance


    INDUSTRY NEWS
    05/19/2006 Ajax grabs center stage at JavaOne, By Tony Baer
    05/15/2006 Oracle to boost AJAX, Java , By Paul Krill
    05/13/2006 Open AJAX Group Drafts Development Plans, By Stacy Cowley
    05/13/2006 AJAX Powers Interactive Marketing ASP, By AjaxWorld News Desk
    05/12/2006 AJAX Experts Tackle Security, Other Issues , By Darryl K. Taft
    05/11/2006 Adobe Releases Spry Framework for AJAX, By AjaxWorld News Desk
    More 
           

          © 2007 ajaximpact.com. All rights reserved.