pablo wrote:
Dear NGers,
I would like to change the alt-text with the changing of the image during a
mouseover action.
Can document.images[0].altView be changed dynamically?
TIA,
pablo
I don't know about a mouseover but I know changing the alt attribute can
be done on a click event which changes the image. I have a demo page
that does that and it works in MSIE 6 SP1a, Mozilla 1.4+, NS 7.1,
K-meleon 0.8.2 and Opera 7.51.
function YourFunctionName(evt)
{
var RefImage = (evt) ? evt.target : event ? event.srcElement : null;
if (RefImage.src.lastIndexOf("Off") != -1)
{
RefImage.src = "path/filenameOn.ext";
RefImage.title = "New title text";
RefImage.alt = "New alternate text";
}
else
{
RefImage.src = "path/filenameOff.ext";
RefImage.title = "Previous title text";
RefImage.alt = "Previous alternate text";
};
}
Not tested on a mouseover. Remember that it takes considerably a lot of
cpu, video memory to change the display of images, furthermore if the
mouseover is done quickly. On some modest system, this may crash the
application. So, the image should definitively be small and have its
number of colors reduced.
DU