![]() |
|
|
#1 | ||
|
Junior Member
Join Date: Oct 2008
Location: Durham
Posts: 18
Thanks: 3
Thanked 1 Time in 1 Post
|
Hi,
I have been working on a site and have added a javascript slideshow and now I'm wondering how to add alt tags to the images? imageArray = new Array(); imageArray[imageNum++] = new imageItem(imageDir + "5678000-01070.jpg"); imageArray[imageNum++] = new imageItem(imageDir + "5678000-01071.jpg"); Any pointers would be greatly appreciated... |
||
|
|
|
|
|
#2 | ||
|
Junior Member
Join Date: Feb 2009
Posts: 20
Thanks: 2
Thanked 2 Times in 2 Posts
|
Code:
images = new Array();
images[count++] = new ImageItem("5678000-01070.jpg", "alt tag for 1070");
images[count++] = new ImageItem("5678000-01071.jpg", "alt tag for 1071");
Code:
function ImageItem(name, alt) {
this.img = new Image();
this.img.src = imageDir + url;
this.alt = alt;
}
Code:
imgObject.src = images[n].img.src; imgObject.alt = images[n].alt; However, there are javascript animation libraries (eg scriptaculous) that you might prefer to use which will take care of appearing and disappearing images as well as giving you more interesting effects (slide up, slide down, fade in, fade out, etc). |
||
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|