JavaScript
  Home arrow JavaScript arrow Active Client Pages: More Questions and An...
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: More Questions and Answers on Chrys`s Approach
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-07-17

    Table of Contents:
  • Active Client Pages: More Questions and Answers on Chrys`s Approach
  • Can any document use Ajax?
  • Can you create your own Back and Forward buttons?
  • The DOM go() Method

  • 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: More Questions and Answers on Chrys`s Approach


    (Page 1 of 4 )

    This is the third part of my series, "Active Client Pages: Chrys’s Approach." We continue to learn the roots that give rise to my approach to Active Client Pages. We will also answer more questions about the technique and its capabilities.

    Can you access the HTML contents of the loading document?

    Assume that you have a document and it loaded another document. Which one is now the current document? You are now at the current document. The question is, can you access the HTML contents of the document that loaded the current document? The answer is no. The DOM specification does not give us any clear method for doing this.

    Can you access the variables and functions of the loading document?

    No. The DOM specification does not give us a clear method for doing this.

    Can any document download a JavaScript?

    Yes. The master document (page), or any loading document or loaded document, can have an external JavaScript tag that would load JavaScript. The loaded script content can be used to produce a new page (document). In the following example, when you click a button in the master page, the master page will produce a new page. The new page has an external JavaScript tag, which will automatically download a JavaScript. This second page has a button. When you click the button, the script loaded will produce a new page. There are three pages altogether. Each page is a document. This is the code for the master page:

     

    <html>

    <head>

    <script type="text/JavaScript">

     

    page2 = "<html>"

    + "<head>"

    + "</head>"

    + "<body>"

    + "This is the Second page.<br />"

    + "<button type="button" id="B1" onclick="show3()">Load Document 3</button>"

    + "<script src="forPage3.js"></script>"

    + "</body>"

    + "</html>";

     

    function show2()

    {

    var pageTwo = document.open();

    pageTwo.write(page2);

    pageTwo.close();

    }

    </script>

    </head>

    <body>

    This is the first page.<br />

    <button type="button" id="B1" onclick="show2()">Load Document 2</button>

    </body>

    </html>

     

    The BODY element of the master page has the sentence “This is the first page.” It also has a line break element and a button. The onclick event calls the function show2(), which loads the second document (page2). We have seen this type of function before. The argument of the write() method is page2.

    This argument (page2) is a variable in the master page having the content of the second document. This content is in a string. All of the entities in the string are escaped. Part of this content is:

     

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

     

    You can identify it in the value of the string variable, page2, where the entities are escaped. You should design the second page so that the browser renders it as it arrives (at the browser). This external JavaScript tag should be at the bottom of the page, so that as the page is loaded, while the user is seeing the content of the page, the downloading of the JavaScript will be taking place.

    The script should not be too long, so that the indicators showing the downloading process should quickly stop their manifestation. The good news is that while the downloading is taking place, the user would still be reading through the second page. For our example here, the script is very short. This is the forPage3.js script content:

     

    function show3 ()

    {

    var pageThree = document.open();

    pageThree.write("This is the third page.");

    pageThree.close();

    }

     

    The script has a function. When you click the button on the second page, this function will be called, and it will load the third page.

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