Skip to page content or skip to Accesskey List.
Search evolt.org
evolt.org login: or register

Work

Main Page Content

A Javascript image viewer

Rated 0 (Add your rating)

Log in to add a comment
(1 comment so far)

Want more?

 
Picture of Ratface

Steve Cook

Member info | Full bio

User since: August 29, 1999

Last login: August 02, 2000

Articles written: 11

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">  
Everything you ever needed to know about me can be found at Cookstour.org.

Submitted by damclean on November 15, 1999 - 15:00.

Thanks for posting your article, from a simple thelist thread. Sorry it took so long to get to the front page. But it's here now.

login or register to post comments

The access keys for this page are: ALT (Control on a Mac) plus:

evolt.orgEvolt.org is an all-volunteer resource for web developers made up of a discussion list, a browser archive, and member-submitted articles. This article is the property of its author, please do not redistribute or use elsewhere without checking with the author.