JavaScript Reference/Javascript Properties/alt
"alt" Example
<source lang="javascript">
<html> <body> <script>
function function1() { document.all.myImage.alt = "alt text"; }
</script> <img id="myImage" onmouseover="function1();" src="yourimage.jpg"> </body> <html>
</source>
"alt" is applied to
<source lang="javascript">
+----------------+--------------------------------------------------------------+ | Applied_To |<applet> <area> | | |<input> <input type="image"> | | |<object> <img> | +----------------+--------------------------------------------------------------+
</source>
"alt" Syntax and Note
<source lang="javascript">
Note: Read and write property. Set the element alternative text. Browser will display the text when element cannot be displayed, or in a tooltip box.
Syntax:
document.getElementById("elementID").alt = value document.all.elementID.alt = value // IE only
</source>