Key press

We can read which key is pressed by user by reading window event. We need to use onkeydown to get arrow keys status. Here is the sample code to read key press
<script language='JavaScript' type='text/JavaScript'>
document.onkeypress = function(key_dtl) {
 key_dtl = key_dtl || window.event; 
var uni_code = key_dtl.keyCode || key_dtl.which; 
var key_name = String.fromCharCode(uni_code); 
alert(key_name); 
}
</script>
Visitors Rating
Your Rating




Google+

Post Comment This is for short comments only. Use the forum for more discussions.




HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us
©2000-2018 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer