JavaScript
  Home arrow JavaScript arrow Page 2 - Creating a Dynamic Banner System with AJAX
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 
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

Creating a Dynamic Banner System with AJAX
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 10
    2007-07-30

    Table of Contents:
  • Creating a Dynamic Banner System with AJAX
  • Creating a system of dynamic banners
  • Displaying the banners on the browser using AJAX
  • Completing the dynamic banner system
  • Listing the banner application's full source code

  • 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


    Creating a Dynamic Banner System with AJAX - Creating a system of dynamic banners


    (Page 2 of 5 )

    The first step involved in building the dynamic banner system is creating a simple front-end, which will be used by the system to display different banners in a predefined time sequence.

    In simple terms, the only requirement to get this AJAX-based application working is the definition of a generic containing element within a web document, where all the banners will be shown, based on a pre-established period of time.

    So, considering this condition, below I built a simple web graphic interface for displaying the banners. The source code that renders this interface is as follows:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-
    8859-1" />
    <title>AJAX-Driven Dynamic Banner System</title>
    <style type="text/css">
    body{
       margin: 0;
       padding: 0;
       background: #eee;
    }

    h1{
       text-align: center;
       font: bold 24px Arial, Helvetica, sans-serif;
       color: #000;
    }

    #bannercontainer{
       text-align: center;
       width: 180px;
       height: 400px;
       margin-left: auto;
       margin-right: auto;
       background: #fff;
       border: 1px solid #000;
    }

    #bannercontainer img{
       border: none;
    }
    </style>
    </head>
    <body>
      <h
    1>AJAX-Driven Dynamic Banner System</h1>
     
    <div id="bannercontainer"></div>
    </body>
    </html>

    As you can see, the above (X)HTML file simply displays on the browser a rudimentary front-end composed of an <h1> header, and the pertinent banner container, in this case identified as "bannercontainer." Very simple, right?

    However, the purpose of this tutorial isn't to show you how to code a basic web page, but demonstrate how to use it to display a predetermined set of dynamic banners via some HTTP request triggered through AJAX.

    Therefore, here's where things get really interesting, since in the section to come I'm going to define a couple of JavaScript functions which will be responsible for fetching the banners from the web server and displaying them on the browser.

    Want to learn more about how these JavaScript functions will look? Click on the link below and keep reading.

    More JavaScript Articles
    More By Alejandro Gervasio


       · If you're a web developer who wants to find other uses for AJAX, this series...
     

    JAVASCRIPT ARTICLES

    - Comparing Fields and Customizing Error Messa...
    - Checking Numbers and File Extensions with jQ...
    - Validating Digits and Dates with jQuery`s Va...
    - Validating Ranges, Emails, and URLs with jQu...
    - More Uses for the jQuery Tooltip Plug-in`s b...
    - Building Image-Based Tooltips with the jQuer...
    - Using the jQuery Tooltip Plug-in`s bodyHandl...
    - Using Rangelength, Min and Max with the Vali...
    - Using Minlength and Maxlength with the Valid...
    - Modifying Tooltip Coordinates with the jQuer...
    - Applying a Fade Out Effect with the jQuery T...
    - Tracking Mouse Movements with the jQuery Too...
    - Checking Online Forms with the Validator jQu...
    - Nested JavaScript Functions as Objects
    - The jQuery Tooltip Plug-in







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek