JavaScript
  Home arrow JavaScript arrow Using Click Interceptions with JavaScript
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  
Mobile Linux 
App Generation ROI 
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

Using Click Interceptions with JavaScript
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-11-05

    Table of Contents:
  • Using Click Interceptions with JavaScript
  • Building a web form for using click interceptions
  • Using click interceptions for submitting and validating a web form via Ajax
  • Full source code for the click interceptions demonstration

  • 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


    Using Click Interceptions with JavaScript


    (Page 1 of 4 )

    Web pages with AJAX tricks load extra content when certain parts of the page are clicked without reloading the entire page. This improves the visitor's experience. Wouldn't you like to get that functionality for your web site? This four-part series shows you how to do it with a technique called "click interception."

    Introduction

    One of the most beautiful aspects of modern web design is the clear differentiation between the distinct parts or layers that comprise a web site. On one hand there's the structural markup that defines the structure of the different web documents of the site, while on the other hand, there are the CSS styles and JavaScript code that reside happily on separated files. What a wonderful scenario!

    Indeed, over the last few years, this model has proven to be an efficient approach when it comes to separating structure from visual presentation, and also when it comes to extending the behavior of a web application by means of unobtrusive JavaScript.

    Naturally, the use of unobtrusive JavaScript code is one of the main pillars for developing client-side applications that will degrade gracefully when scripting has been disabled on a browser, meaning that it's possible, for instance, to enrich (or expand) the behavior of a database-driven web application via client-side scripting without making the application itself depend entirely of JavaScript.

    This way of linking one or more JavaScript programs to the bare bones structure of a web document leads directly to the implementation of a helpful technique known as "click interception." Before you start asking yourself what it is, let me give you a simple example: suppose for a moment that you've built with plain (X)HTML a fancy navigation bar for your brand new web site, whose elements link to different web pages. So far, nothing too complicated, right?

    Now, say that instead of showing the contents of these web pages in different windows, you want to display them in a container of the same web document via Ajax. In this particular situation, you can assign an "onclick" event handler to each link of the navigation bar to handle each HTTP request without having to reload the whole web page. This means that you're actually "intercepting" each click (hence the method's name) and handling the requests in the way that you want.

    Plus, there's an additional advantage in using click interceptions within the context of the previous example. If scripting has been disabled on the browser for whatever reason, the navigation bar will still work. Simple and efficient!

    Now that you have a pretty clear idea of what a click interception is, it's time to move forward and back up these concepts with concrete examples. Having said that, in this article series, I'll be showing you how to implement click interceptions in different cases, so you can use them successfully as part of your own JavaScript applications.

    Let's begin now!

    More JavaScript Articles
    More By Alejandro Gervasio


       · Click interceptions are a handy technique used for building JavaScript applications...
       · What is the purpose/function of the initializeForm function?
       · Thanks for commenting on my article. As I explained in the article, the...
     

    JAVASCRIPT ARTICLES

    - More on JavaScript Array Objects
    - Methods of the DOM Location Object
    - The DOM Location Object Properties
    - Handling Remote Files with JavaScript Click ...
    - Using Click Interceptions with a Database-Dr...
    - Using JavaScript Click Interceptions in an I...
    - Using Click Interceptions with JavaScript
    - QuickSort in Action
    - Quicksort
    - Using Mod_Security to Protect Your Server
    - Detecting and Countering Server Intrusions
    - Securing Your Web Server
    - Building a Secure Web Server
    - Protecting the Server
    - Book Review: Learning the Yahoo! User Interf...


     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT