By Deane Barker on September 24, 2003

ALTer: Adam Kalsey whipped up a quick script to add ALT attributes to all IMG tags in a site. Sometimes, the simple solutions are the best.

“The program walks through a directory and opens every file ending with .html or .htm. Then it looks for image tags without alt attributes and adds them in. The alt text that it adds comes from a pipe-delimited data file containing image file names followed by the alt text. If the program comes across an image that doesn’t have an alt attribute and it isn’t listed in the data file, an empty alt attribute is inserted. Image tags that already have alt attributes are ignored.”