Home arrow JavaScript arrow Page 2 - Principles of Active Client Pages: the Script Approach
JAVASCRIPT

Principles of Active Client Pages: the Script Approach


In this part of the series, I give the principles of the Script Approach to Active Client Pages. I am the one who came up with these principles to suit the advantages I mentioned in the previous part of the series. In order for you to understand the Script Approach, I will have to explain the simple example we saw previously. This article is the second part of a three-part series.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
June 12, 2009
TABLE OF CONTENTS:
  1. · Principles of Active Client Pages: the Script Approach
  2. · Source Code
  3. · String Content
  4. · Principles of the Script Approach

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Principles of Active Client Pages: the Script Approach - Source Code
(Page 2 of 4 )

The source code for the file of the frame is:

 

<html>

 

<script type="text/javascript">

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

</script>

 

</html>

 

Yes, it is very short. It has to be like that, since we always have to be changing all (or almost all) of its content. Its initial content is downloaded with the frameset, as a string value of the first element of the array.

For the frame file, you have just the start and end HTML tags, and a little JavaScript. All that the script does is write into the document (page) the value of an element in the array of the frameset script. It uses the expression "document.write()," which generally replaces all the content of the page. The argument for this expression is

 

parent.theArray[parent.pInx]

 

The parent here refers to the frameset. This is followed by a dot, then the array in the frameset script. The index of the array object here is

 

parent.pInx

 

Remember that pInx is a variable in the frameset script. The value of this variable is an integer, which can be changed by script. The integer is always an index of the array. So to access it from the frame, just as to access the array from the frame, you need to begin with "parent" followed by a dot. So the value of pInx determines the page that we see.


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials