Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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

You are here: irt.org | FAQ | JavaScript | Image | Q537 [ previous next ]

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?'

©2018 Martin Webb