"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Wednesday, August 11, 2010

unicode of the key pressed in alert box

 Hi friendz,
As every key on keyboard had an Unicode.Some times it help when we run around java-script.

Code

<html>
<head>
<script type="text/javascript">
function whichButton(event) {
alert(event.keyCode)
}
</script>
</head>
<body onkeyup="whichButton(event)">
<p><b>Note:</b> Make sure the right frame has focus when trying this example!</p>
<p>Press a key on your keyboard. An alert box will alert the unicode of the key
pressed.</p>
</body>
</html>


Have a nice day... 'N happy Coding :)

No comments: