JavaScript
  Home arrow JavaScript arrow Page 3 - A Document Moving Store for Active Client ...
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

A Document Moving Store for Active Client Pages
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 2
    2009-07-24

    Table of Contents:
  • A Document Moving Store for Active Client Pages
  • How does the User correct an Error in a Previous Page?
  • Explanation of the Script in the Master Page
  • The page2Script.js 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


    A Document Moving Store for Active Client Pages - Explanation of the Script in the Master Page


    (Page 3 of 4 )

    Let us look at the master page script in detail. Everything in the first page comes from the server. The first code segment is the store; an array is created. The first element of the array has the value "oneA." The next element has the value "twoA."

    The next code segment is the content of the second page in string form. The entities have been escaped. These are the page elements, removed from the string.

    <html>

    <head>

    </head>

    <body>

    This is the second page.<br />

    <button type="button" onclick="showStoreValues()">Show Store Values</button>

    <button type="button" onclick="loadThirdPage()">Load Third Page</button>

     

    <table id="S2" style="display:none">

    <tr><td></td></tr>

    <tr><td></td></tr>

    </table>

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

    </body>

    </html> 

    It has the HTML element. It has a HEAD element, which is empty. It has a BODY element. The first thing in the BODY element is text, which indicates that you are on the second page. Next you have a line break element.

    After that you have two buttons. When clicked, the first one will display the values of the store in the second page. The second button, when clicked, loads the third page. Each of these two buttons calls a function that is in the external script below.

    So the external script must be loaded before the buttons can become effective. I assume that before the user decides to click any of the buttons, the external script would have been loaded. If you think that by the time the user decides to click the buttons, the external script would not have been loaded, then put the functions for the button in a script in the HEAD element of the second page.

    In the present case, while the user is still reading the page, the external script is being downloaded. The page has been designed so that it is rendered as it arrives at the browser. By the time the user decides to click any of the buttons, the script would have been downloaded. This is a feature of the ACP Script Approach in a simple format.

    Next is the store of the second page. This store is an HTML table element. It has two rows of one cell each. It mimics the one dimensional array store in the master page. The value of its display property is "none," so it is not displayed and it does not occupy space.

    You can put the store as the first thing in the second page. I did it like this just to show you that the user has to read the page before he takes an action that will make use of the store (here, the store is rendered later than the buttons). The cell contents will be filled with values from the array in the store in the master page, by script in the previous (master) page.

    After the code for the store of the second page, we have the external JavaScript tag. This tag downloads the script to be used by the second page (and to be used by the buttons of the second page as well). While the user is still reading the second page that has just been loaded, the script is being downloaded.

    Let us continue to look at what is in the script of the master page. You have the openWrite() function just below the variable for the string of the page content of the second page. This function loads the second page. I will only explain the extra statement(s) in the openWrite() function. In your project, you can change the name of the function to something like loadSecondpage().

    The extra statement in the function is a for-loop. This loop copies the values of the store array in the master page, to the store table in the loaded second page. There is one line in the for-loop. It uses DOM features to do this.

    That is it for the second page's content. Let us now look at what is in the external script of the second page.

    More JavaScript Articles
    More By Chrysanthus Forcha


     

    JAVASCRIPT ARTICLES

    - Using jQuery to Preload Images with CSS and ...
    - Using Client-Side Scripting to Preload Image...
    - Removing Non-Semantic Markup when Preloading...
    - Using the Display CSS Property to Preload Im...
    - Preloading Images with CSS and JavaScript
    - Scaling and Moving Web Page Elements with th...
    - Fading, Hiding and Sliding HTML Elements wit...
    - Toggling CSS Properties with the GX JavaScri...
    - Cancel, Queue and Pause Animations with the ...
    - Producing Elastic Effects with the GX JavaSc...
    - Moving Divs Diagonally with the GX JavaScrip...
    - Moving Elements Vertically and Horizontally ...
    - Making Bouncing Effects in Parallel with the...
    - Creating Bouncing Effects with the GX JavaSc...
    - Manipulating Background Colors with the GX J...







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