JavaScript Reference/Javascript Properties/alt
"alt" Example
<html>
<body>
<script>
function function1() {
document.all.myImage.alt = "alt text";
}
</script>
<img id="myImage" onmouseover="function1();" src="yourimage.jpg">
</body>
<html>
"alt" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<applet> <area> |
| |<input> <input type="image"> |
| |<object> <img> |
+----------------+--------------------------------------------------------------+
"alt" Syntax and Note
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