Main Page Content
A Javascript image viewer
Rated 0 (Add your rating)
Log in to add a comment
(1 comment so far)
The following code is for a generic Javascript image viewer that I have been using in a project.
The project is an HTML based CD-Rom. The CD contains a large amount of images and I wanted a solution to be able to include thumbnail images in a group of pages and link to a larger version of the image. I did not however, want to maintain a large number of extra pages containing the larger images.
Instead I decided to write a dynamic page containing all the required info. At first, I tried sending all the required info to build the page in the QueryString. Hmm, this worked after a fashion, but everything needed URLencoding, the querystrings were a pain to write for each link and it didn't work on all the browsers I tested on.
Then, after discussing the issue on "The List", Jeff Howden came up with the idea that I have implemented in the script below (I would like to stress that this is pretty much his code).
This script takes a single number as an argument (which I have passed from the link by updating a JavaScript variable in an unchanging frame on the site). It then reads values from a set of arrays, which contain all the information required to build up each page.
Using such a method, it is possble to build quite complex dynamic pages, though I feel the method is especially suited to image libraries.
Here's the page
<HTML> <HEAD> <TITLE>Image viewer Javascript</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- // Script developed by Steve Cook (steve@cookstour.org) // From an idea by Jeff Howden (c4wd@triax.com) // Feel free to use and extend :-) /* This is a script to grab the image name from the previous link and display a page Link to the script like so - <A HREF="image_viewer.htm">



