Home arrow JavaScript arrow Page 3 - An Example Image Gallery with Chrys`s Approach to ACP
JAVASCRIPT

An Example Image Gallery with Chrys`s Approach to ACP


This is the seventh part of my series "Active Client Pages, Chrys’s Approach." In this part of the series, we look at how the Document Phase can help us with images. You need good knowledge of HTML, JavaScript and Perl in order to understand this part of the series.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
August 14, 2009
TABLE OF CONTENTS:
  1. · An Example Image Gallery with Chrys`s Approach to ACP
  2. · The Code for the Second Page
  3. · Code for the Third Page
  4. · Code for the Third Page Continued

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
An Example Image Gallery with Chrys`s Approach to ACP - Code for the Third Page
(Page 3 of 4 )

This code is in a string in a Perl file in the server. This is the content of the Perl file:

 

$returnStr = qq{

<html>

<head>

<script type="text/javascript">

presentID = "I0";

nextID = "I1";

numb = 1;

 

function nextPicture()

{

document.getElementById(presentID).style.display = "none";

document.getElementById(nextID).style.display = "block";

 

presentID = nextID;

numb+=1;

nextID = "I" + ((numb)%3);

}

</script>

</head>

<body>

This is the third page. <br />

<table id="T3" border="1">

<tr><td width="234" height="188"></td></tr>

</table>

 

<button onclick="nextPicture()">Next Picture</button>

 

</body>

</html>

};

 

print $returnStr;

 

The file has the HEAD element of the third page. The HEAD element has a short JavaScript. If it were long, then it could be put below the visible elements of the page, so that it would be rendered after the visible elements have been rendered.

Let us talk about what is in the BODY element for the third page first. You have text that indicates that you are on the third page. This is followed by the line break element. Next you have a one-cell table. The dimensions of this cell have been given (so that it should not collapse when there is no image in it). There are three image tags in this cell, as we saw above. At any time, only one of the images can have the value of "block" for the display property.

Below the table tag ID is a button tag. When this button is clicked, the next picture will be displayed. All the pictures are of the same dimensions. As we said before, the pictures are displayed, one at a time. They are displayed one at a time in the one cell of the table. Each time the button is clicked, the nextPicture() function is called.


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