当前位置: 代码迷 >> ASP.NET >> javascript和asp.net中怎么捕获Ctrl+Alt 等组合键
  详细解决方案

javascript和asp.net中怎么捕获Ctrl+Alt 等组合键

热度:3351   发布时间:2013-02-25 00:00:00.0
javascript和asp.net中如何捕获Ctrl+Alt 等组合键?
如题

------解决方案--------------------------------------------------------
可以
------解决方案--------------------------------------------------------
<html>
<head>
<script language=@#javascript@#>
<!--
function issueCommand(x){
if (document.layers)
{
if (x.which==99||x.which==67)
window.close();
else if (event.keyCode==112||event.keyCode==80)
self.print();
else if (event.keyCode==110||event.keyCode==78)
alert( "Sorry, this is the only song in the List ");
}
else if (document.all){

if (event.keyCode==99||event.keyCode==67)
window.close();
else if (event.keyCode==112||event.keyCode==80)
self.print();
else if (event.keyCode==110||event.keyCode==78)
alert( "Sorry, this is the only song in the List ");
}

}


//-->
</script>
</head>

<body>
<script language=@#javascript@#>
<!--
if (document.layers)
document.captureEvents(Event.KEYPRESS);

document.onkeypress=issueCommand

-->
</script>

<font size=6> <u> P </u> ress P </font> <p>

<font size=6> <u> N </u> ext One </font> <p>

<font size=6> <u> C </u> lose Window </font> <p>
</body>
</html>
  相关解决方案