JavaScript
  Home arrow JavaScript arrow Page 2 - Building Pop-Up DIVs with the DOM and 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 
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

Building Pop-Up DIVs with the DOM and AJAX
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 10
    2007-01-31

    Table of Contents:
  • Building Pop-Up DIVs with the DOM and AJAX
  • Developing a basic pop-up DIV
  • Dynamically creating a pop-up DIV
  • Completing the pop-up DIV script

  • 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


    Building Pop-Up DIVs with the DOM and AJAX - Developing a basic pop-up DIV


    (Page 2 of 4 )

    As with many cases concerning the development of web applications, here the best approach to follow begins with a simple example. In the next few lines I’m going to demonstrate how to build a single pop-up DIV which can be attached to any element of a web page. Sounds fairly comprehensive, doesn’t it?

    Additionally, in the following screen shot shows clearly that this pop-up DIV is going to work. Have a look at it, please:

    Now that you know how the pop-up DIV will work, below I list the markup that corresponds to a basic web page, which contains a single containing element identified as “container.” As you'll see in a few moments, I’ll use this element to attach it to a pop-up DIV via the DOM. But for now I’d like you to take a look at the web document. Here it is:

    <!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>JavaScript-based Pop-Up Div</title>
      </head>
      <body>
       
    <h1>JavaScript-based Pop-up Div</h1>
        
    <div class="popupcontainer" id="container">
          
    <p>Content for containing DIV goes here...<br />
            
    Content for containing DIV goes here...<br />
            
    Content for containing DIV goes here...<br />
            
    Content for containing DIV goes here...<br />
             
    Content for containing DIV goes here...<br />
             
    Content for containing DIV goes here...<br />
            
    Content for containing DIV goes here...</p>
       
    </div>
      </body>
    </html>

    As you can see, the structure of the above web page is really simple. Logically, the only detail worth noticing is the inclusion of a DIV element which will be used later on for annexing it to a neat pop-up box, by using the DOM.

    So far, so good. As you saw in the previous example, creating the basic markup structure for including a simple pop-up DIV in a web page is indeed a process that can be performed with minor hassles.

    Therefore, what comes next? Well, since I already showed you the signature of the web document  where I plan to append a pop-up box, in the section to come I’m going to teach you how to create this element in question by using some straightforward DOM methods.

    As usual, to see how this will be done, please click on the link below and keep reading.

    More JavaScript Articles
    More By Alejandro Gervasio


       · In this first article of the series, a basic method for creating pop-up DIVS is...
     

    JAVASCRIPT ARTICLES

    - 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...
    - Dynamically Generate a Selection List in a R...
    - Intergrate DWR into Your Java Web Application
    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget






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