标签:返回键 onload tle onclick initial pre strong 数字类型 code
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <title>键盘事件</title> 5 <meta charset="UTF-8"> 6 <meta name="viewport" content="width=device-width, initial-scale=1"> 7 <script> 8 window.onload = function(){ 9 document.onkeydown = function(ev){ 10 var ev = ev || event; 11 //alert(ev.keyCode); //返回键盘的ASCII 码 12 } 13 14 document.onclick = function(ev){ 15 var ev = ev || event; 16 alert(ev.ctrlKey);//点击时返回false,按住ctrl键之后再点击的同时会返回true 17 } 18 } 19 </script> 20 </head> 21 <body> 22 <div> 23 24 </div> 25 </body> 26 </html>
标签:返回键 onload tle onclick initial pre strong 数字类型 code
原文地址:http://www.cnblogs.com/sese/p/7271695.html