This is help





Keep the mouse pointer over the above image and see how the alt message changes as you enter text inside the above text box

Here is the text as you enter.



Return to tutorial on image alt tag

JavaScript

<script language='JavaScript' type='text/JavaScript'>
<!--
function change_title(keyEvent){ 
//alert(keyEvent); 
keyEvent = (keyEvent) ? keyEvent: window.event; 
input = (keyEvent.target) ? keyEvent.target : 
keyEvent.srcElement; 
if(keyEvent.type=="keyup"){ 
if(input.value){ 
//document.getElementById('i1').alt=document.getElementById("t1").value;
document.getElementById('i1').title=document.getElementById("t1").value;

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

HTML

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

<input type=text id='t1' size=50 onkeyup='change_title(event)';><br><br>
 <br><br>Keep the mouse pointer over the above image and see how the alt message changes
 as you enter text inside the above text box<br><br>
Here is the text as you enter.<br><br>
<div id="d1"></div>