李
>
,
<强> 强>
1, & lt; input type=" text ", id=拔谋尽钡脑?, 2,& lt; script>,, 3,,,,,. getelementbyid(“文本”).onkeypress =,函数(e), {,, 4,,,,,,,,,警报(“按键码:,“,+,e.which +,”,字符:,“,+,String.fromCharCode (e.which)),,,,,,, 5,,,,,},,, 6,& lt;/script>
FireFox、Opera, Chrome输入“a”;
输出:,“按键码:97,字符:"
,
1, & lt; input type=" text ", id=拔谋尽钡脑?, 2,& lt; script>,, 3,,,,,. getelementbyid(“文本”).onkeypress =,()函数,{,, 4,,,,,,,,,警报(“按键码:,“,+,window.event.keyCode +,”,字符:,“,+,String.fromCharCode (window.event.keyCode)),,,,,,, 5,,,,,},,, 6,& lt;/script>
,
<强> 强>
<>之前,& lt; input type=" text ", id=拔谋尽钡脑?,,& lt; script>,,,,,,, . getelementbyid(“文本”)只=,,,,,,,,,,,(==navigator.appName “Microsoft Internet 探险家”,,,,,,,,,,,,,alert("按键码:,“,+,window.event.keyCode +,”,字符:,“,+,,,,,,,,,},,(==navigator.appName “网景”,,,,,,,,,,,,,alert("按键码:,“,+,e.which +,”,字符:,“,+,,& lt;/script>
,
1, & lt; input type=" text ", id=拔谋尽钡脑?, 2,& lt; script>,, 3,,,,,. getelementbyid(“文本”).onkeypress =,函数(e), {,, 4,,,,,,,,,e =, e | |, window.event;,, 5,,,,,,,,,key =, e.keyCode | |, e.which | |, e.charCode;,, 6,,,,,,,,,警报(“按键码:,“,+,key +,”,字符:,“,+,String.fromCharCode(关键),,,,,,,, 7,,,,,},,, 8,& lt;/script>
: