View Full Version : How to add Alt text to the images in the Simple Controls Gallery

11-07-2011, 04:11 AM
1) Script Title: Simple Controls Gallery

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/simplegallery.htm

3) Describe problem: what changes need to be made to the .js file to produce alt text for the images in the simple gallery viewer? :confused:

11-07-2011, 05:20 AM
Your images in the gallery already have alt attributes.

11-08-2011, 06:39 AM
Hi, thanks for replying. The text at the top of the images that appears on hover...yes, I thought that value had been labeled as the alt text for the image in the description of the image viewer. But when I test the page in site analyzer tools they aren't interpreted as alt text.

11-08-2011, 08:35 AM
Why is that important? Are you primarily concerned with accessibility or SEO? Something else?

As far as SEO goes, if you Google the alt attributes of the images, your page comes out on top. I haven't checked any other search engines, but Google is the industry standard. If others don't work like it does in this regard now, they probably will soon enough.

On the accessibility front, those with screen readers or images disabled should be able to respectively hear or see the alt attributes IF they have javascript enabled (this is similar to a 'normal' user who will not see the slideshow if javascript is turned off). To accommodate them and other non-javascript users you could put your slideshow images in a noscript tag as regular image tags with alt attributes. You could even include the descriptions as ordinary text and/or links in the noscript element. This will help all non-javascript users, not just those who are differently abled or who have images turned off.

In any event the images have alt attributes, any decent DOM inspector shows that they do. And I see that you've modified the script to use the image descriptions as alt attributes.

BTW, the alt attribute is NOT intended as a hover description. That's the purpose of the title attribute. IE less than 8 will use the alt attribute like a title attribute if there is no title attribute. This is non-standard behavior, corrected in later versions. All other browsers follow the standard here. If desired, empty title attributes may be given to images to prevent IE 7 and less from displaying the alt attribute as a title attribute. Likewise, the alt attribute may be duplicated as the title attribute to allow standards compliant browsers to display them as hover descriptions. One may also use different alt and title attributes.

11-08-2011, 05:14 PM
Got it, thanks for all the input :)