Show Each Char As It Is Typed

[Total: 0    Average: 0/5]

This shows how to use either NS or IE to trap the character as it is type by the user.

Body Code:

<script type=text/javascript>
if (navigator.appName == 'Netscape'){ 
  document.captureEvents(Event.KEYPRESS); 
} 
document.onkeypress = KeyPress; 
function KeyPress(e){ 
  if (navigator.appName == 'Netscape'){ 
    document.exf1.key.value=e.which + " = ("+String.fromCharCode(e.which)+")"; 
  } 
  if (navigator.appName == 'Microsoft Internet Explorer'){ 
    document.exf1.key.value=window.event.keyCode + " = ("+String.fromCharCode(window.event.keyCode)+")";
  }
} 

</script>
<form name=exf1>
<input type=text name=key value="?">
</form>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *