Default alt text




Enter text and click the button to see how the alt and title of the image changes, Keep the mouse pointer over the above image.

Here is the text as you enter.



Return to tutorial on image alt tag

JavaScript

<script language='JavaScript' type='text/JavaScript'>
<!--
function change_title(){ 
document.getElementById('i1').alt=document.getElementById("t1").value;
document.getElementById('i1').title=document.getElementById("t1").value;

document.getElementById("d1").innerHTML= document.getElementById("t1").value;
}
//-->
</script>

HTML

<img src=images/help.jpg id='i1' alt='Default alt text' width=50, hight=50>
<br><br>

<input type=text id='t1' size=50 ><input type=button onclick='change_title()'; value='Change Alt'><br>
 <br><br>Enter text and click the button to see how the alt and title of the image changes, Keep the mouse pointer over the above image. <br><br>
Here is the text as you enter.<br><br>

<div id="d1"></div>