用JavaScript代码给网页热键功能

时间:2010-04-20 17:41:00  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:bsp;  if (x.which==99||x.which==67)            window.close();        else if (event.keyCode==112||event.keyCode==80)            self.print();        e...
  正文:

<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>


用JavaScript代码给网页热键功能》由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Programming/JavaScript/13721.html


关键字:

关于《用JavaScript代码给网页热键功能》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td