JavaScript
  Home arrow JavaScript arrow Page 3 - Principles of Active Client Pages: the Scr...
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

Principles of Active Client Pages: the Script Approach
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-06-12

    Table of Contents:
  • Principles of Active Client Pages: the Script Approach
  • Source Code
  • String Content
  • Principles of the Script Approach

  • 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


    Principles of Active Client Pages: the Script Approach - String Content


    (Page 3 of 4 )

    Look at the string content of the first page in the frameset document from the first part of this series. There is a button there. The onclick attribute of this button actually has the following value:

     

    parent.pInx = 1;location.replace('myChild.htm')

     

    There are two statements here. When the button is clicked, we have to see the next page, so the value of the pInx in the frameset script is set to 1; this is what the first statement does. The next statement asks the document of the frame to redisplay itself. In the course of redisplaying itself, it encounters the following script:

     

    <script type="text/javascript">

    document.write(parent.theArray[parent.pInx])

    </script>

     

    Now, the value of pInx is 1, so the second page is displayed. However, before this, the second element (index 1) of the array in the frameset script should have had the content of the second page, excluding the <html> and </html> tags.

    Look at the string content of the first page in the frameset document from the first part of the series again. There is an external JavaScript tag at the bottom. This tag is actually

     

    <script src="forNextPage.js"></script>

     

    When the first page is displayed, this tag downloads the JavaScript file named forNextPage.js. Now with ACP you design your web page so that it should be rendered by the browser as it arrives at the browser.

    So, while this file is being downloaded, the user is reading what has been displayed on the page, above this tag. As soon as the first page is displayed, the user starts reading it. Since the page is being rendered as it arrives, by the time the user has read anything useful, this file would have been downloaded. This is the content of the file:

     

    parent.theArray[1] = "<html>";

    parent.theArray[1] += "<head>";

    parent.theArray[1] += "</head>";

    parent.theArray[1] += "<body>";

    parent.theArray[1] += "This is the second page seen.";

    parent.theArray[1] += "</body>";

    parent.theArray[1] += "</html>";

     

    When the file is downloaded, its statements are executed, while the page in which its tag is, is still open. As you can see, the file assigns the content of the second page as a string to the second element of the array in the frameset script. These statements are executed in the frame document, so to address the array on the frameset script we have to start with the word "parent."

    This external script may also have an external script tag that has content for some following page. The following code illustrates this:

     

    parent.theArray[1] = "<html>";

    parent.theArray[1] += "<head>";

    parent.theArray[1] += "</head>";

    parent.theArray[1] += "<body>";

    parent.theArray[1] += "This is the second page seen.";

    parent.theArray[1] += "<script src="forNextPage2.js"></script>";

    parent.theArray[1] += "</body>";

    parent.theArray[1] += "</html>";

     

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