Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q537 Is there a way to set the 'alt' property in an image object similar to the 'src' property?

irt.org | Knowledge Base | JavaScript | Image | Q537 [ previous next ]

Q537 Is there a way to set the 'alt' property in an image object similar to the 'src' property?

Only in Internet Explorer 4+:

<img src="picture.gif" alt="text">

<script language="JavaScript"><!--
alert(document.images[0].src);
if (document.all) {
    alert(document.images[0].alt);
    document.images[0].alt = 'Updated text';
    alert(document.images[0].alt);
}
//--></script>

Feedback on 'Q537 Is there a way to set the 'alt' property in an image object similar to the 'src' property?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.