JavaScript
  Home arrow JavaScript arrow Active Client Pages: Simple Document Phase...
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

Active Client Pages: Simple Document Phase Example Continued
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-08-07

    Table of Contents:
  • Active Client Pages: Simple Document Phase Example Continued
  • The Code Segments
  • The JavaScript Code Segment
  • The Content of the Third Page

  • 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


    Active Client Pages: Simple Document Phase Example Continued


    (Page 1 of 4 )

    In this sixth part of a twelve-part series on Active Client Pages (ACP), we complete the simple example that illustrates the Document phase of Chrys’s Approach. You need good knowledge of HTML, JavaScript and Perl to understand this part of the series.

    Simple Document Phase Example Continued

    The page2Doc Content

    We are still dealing with the code for the master page. Remember that the content of the page2Doc variable is the downloaded string, which in our simple example is the HTML content (including its JavaScript). This string is actually prepared using Perl. It resides in a Perl file called sendPge2Str.pl in the cgi-bin directory in the server. The Ajax code segment in the master page downloads this string.

    Skeleton of the page2Doc String at Server

    This is the skeleton of the content of the sendPge2Str.pl file at the server.


    $returnStr = qq{

    <html>

    <head>

    </head>

    <body>

    < -- The HTML elements -- >

     

    <script type= "text/JavaScript">

     

    < -- Ajax Code -- >

     

    < -- Function to develop and load the third page -- >

     

    </script>

    </body>

    </html>

    };


    print $returnStr;


    There are two Perl statements here. The first one declares the $returnStr variable and assigns the string that has the second page content to it. The other Perl statement is “print $returnStr;”. The statement sends the string to the browser at the Ajax code segment in the master page.

    Take a close look at the string declaration. In simplified form, it is

    $returnStr = qq{string content};

    The double q (qq) precedes the block with the {} brackets. The double q with the {} brackets form what is called the quoting operator in Perl. It is denoted by qq{}. Everything inside the curly brackets is interpreted as a string. So with the qq{} operator, the content in the block can have quotation marks; you do not have to escape any entity in the block.

    The content in the qq{} operator above is the HTML document for the second page at the browser. You type everything in the qq{} operator exactly as you would for the HTML document. Do not escape anything. There are two main code segments in the BODY element (in this file). The first one is for the HTML elements. The second one is a JavaScript. This JavaScript has two sub code segments.

    More JavaScript Articles
    More By Chrysanthus Forcha


     

    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 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek