I want to know which keys were pressed along with the ctrl key or any key. For this i wrote like this
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script type="text/javascript">
function onkeyPressEvent(e) {
var keycode;
var keyname;
if(window.event)
{
if(e.keyCode && e.ctrlKey)
alert("ctrl + key Pressed");
//keycode = e.keyCode;
}
//keyname = String.fromCharCode(keycode);
//if(keyname.length!=0)
//alert(keyname)
}
</script>
</head>
<body onkeypress="onkeyPressEvent(event)">
<form id="form1">
<div></div>
</form>
</body>
</html>
But this is not working properly. In IE if we click on Ctrl+T it is opening new tab. how to disable these type of short cuts in our programming using javascript. I want a alert box stating that which key was pressed along with ctrl.
Thanks,
Here is your code..