Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image Swaping

Status
Not open for further replies.

Lambro

Programmer
Aug 22, 2001
258
US
I have a database that stores the image name. The images are stored in a directory called img. In the database table images, I have fields image1 and image2. What I want is to display these images on a page. I want the script to check the database to see if there's image1, if so display it. If there is also an image2 I want image1 to be displayed for 10 seconds then for image2 to fade in or just appear where image1 was. I want image2 to appear for 10 seconds then go back to image1 and so on. Both images will be the same size.
 
This is a tricky thing to do since you have to preload leave the data on the client side. Probably the best way I can think of doing it is to use hidden form fields. Then write a client side script to handle the timer and appearing of the hidden fields.

Let me know if you need some examples.

Cassidy
 
well you could use the ASP to somewhat dynamically write the javascript for it, through conditionals and so forth.

but even then, i'd handle it all in the JS side of things, like :
First Image Pair
<img 1 NAME=swapper1 ID=swapper1>
<img 2 NAME=swapper1 ID=swapper1 visible=false>

Second Image Pair
<img 1 NAME=swapper2 ID=swapper2>
<img 2 NAME=swapper2 ID=swapper2 visible=false>

Third Image Pair, but there's no second image for this product
<img 1 NAME=swapper3 ID=swapper3>

then just cycle thru the getElement set for images only, with a name or id like swapper, and handle them in pairs OR
you could name all image1's the same, name all image2's the same, then just do a class shift, on products with no second image, just double up the first, it'll fade to itself, none the wiser.



[thumbsup2]DreX
aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top