<div class="codetitle"> <span><a style="CURSOR: pointer" data="31103" class="copybut" id="copybut31103" onclick="doCopy('code31103')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code31103"> <br>document.onkeypress = function( e ){ <br>alert( getCharCode( e ) ); <br>}; <br>function getCharCode( e ){ <br>var e = e || window.event; <br>if( typeof e.charCode == "number" ){ <br>return e.charCode; <br>}else{ <br>return e.keyCode; <br>}; <br>}; <br> </div>