JavaScript
  Home arrow JavaScript arrow Page 4 - Active Client Pages: the Script Approach
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: the Script Approach
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-06-05

    Table of Contents:
  • Active Client Pages: the Script Approach
  • Active Server Pages and Active Client Pages
  • Secret of Active Client Pages
  • A Simple Example

  • 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: the Script Approach - A Simple Example


    (Page 4 of 4 )

    I will use a simple example to illustrate the approach. In this example, you have a frameset with only one frame. There is JavaScript in the HEAD element of the frameset. This script has permanent variables (and can also have functions). The page (document) of the frame has an Input Text control. The frame page also has a script in its HEAD element.

    When the frame is loaded, this script reads a value, “John,” of a variable from the frameset JavaScript and displays it in the Input Text control of the frame document. At the bottom of the frame page, a JavaScript is loaded. This script contains another content of the frame; that is, this script contains the next page. This content in the script will replace the present content of the frame, to give us the second document (page).

    The frameset document and HTML file for the frame are downloaded at the same time. The frame document has an Input Text control. The onload event of the BODY element of the frame copies the value “John” of the variable from the frameset JavaScript into the Input Text control of the frame document.

    There is an HTML button on the frame document. When you click it, you see the next page. This is the code of the frameset and the content of the first page. It needs explanation.

    <html>

    <head>

    <script type="text/javascript">

    var theArray = new Array()

     

    theArray[0] = "<head>";

    theArray[0] += "<script type="text/javascript">";

    theArray[0] += "function giveValue()";

    theArray[0] += "{";

    theArray[0] += "document.getElementById('FN').value = parent.defaultValue;";

    theArray[0] += "}";

    theArray[0] += "</script>";

    theArray[0] += "</head>";

    theArray[0] += "<body onload=giveValue()>";

    theArray[0] += "<label for="FN">First Name</label> <input type="text" id="FN"> <br />";

    theArray[0] += "<button type="button" onclick="parent.pInx = 1;location.replace('myChild.htm')">Display Second


    Page</button>";

    theArray[0] += "<script src="forNextPage.js"></script>";

    theArray[0] += "</body>";


    var pInx = 0;



    var defaultValue = "John";


    </script>

    </head>

    <frameset cols="100%,*">

    <frame src="myChild.htm" name="myChild">

    </frameset>

    </html>


    We shall have the explanation in the next section.

    I have given you a lot for this part of the series. Let us take a break and continue in the next part of the series.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

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