Forum Moderators: open
i have this script on a few roll over images on my page, but only one of them will not validate to xhtml - transitional. here's the code:
<img src="images/exclamation.jpg" alt="exclamation" name="Image1" width="25" height="25" border="0" id="Image1" onmouseover="MM_swapImage('Image1','','images/exclamation2.jpg',1)" onfocus="MM_swapImage('Image1','','images/exclamation2.jpg',1)" onmouseout="MM_swapImgRestore()" onblur="MM_swapImgRestore()" />
All the other instances pass but this one fails. I need onfocus on blur for accessibility reasons.
Any clues as to how i can get it to validate?
Thanks
onblur attribute can only be used on the following elements: a, area, label, input, select, textarea, and button (see the W3C documentation [w3.org]). So it won't validate when using it on an image tag. It terms of accessibility, I'm not sure it adds much value: if the image is merely a ancillary visual clue, it won't matter than the image won't swap when using tabbed navigation. If the image swap is critical to the understanding of the function, then it is inherently inaccessible already as the effect will only be useful to sighted visitors.
I have managed to place the onfocus/blur on an a tag on the image.
The WACG guidlines are ambiguous towards this topic. They state that if scripts are used for mare than changing colours, use device independent dodars by using onfocus onblur with onmouseover on mouseout.
Since all i'm doing is changing the colour of an image on hover, does this mean i don't have to use device independent controllers? Every accessibility checker fails it without because it can't interpret the guidlines, they just look for the scripts.
Very annoying.
Anyway problem solved. thanks guys.