1: <script type="text/javascript">
   2: <!--
   3:
   4: if(document.addEventListener){//如果是Firefox
   5: document.addEventListener("keypress",fireFoxHandler, true);
   6: }else{
   7: document.attachEvent("onkeypress",ieHandler);
   8: }
   9:
  10: function fireFoxHandler(evt){
  11: //alert("firefox");
  12: if(evt.keyCode==13){
  13:    validateLogon();//你的代码
  14: }
  15: }
  16:
  17: function ieHandler(evt){
  18: //alert("IE");
  19: if(evt.keyCode==13){
  20:    validateLogon();//你的代码
  21: }
  22: }
  23:
  24: //-->
  25: </script>

本文地址:http://www.yaronspace.cn/blog/index.php/archives/307

来自yaronspace.cn  本文链接:http://yaronspace.cn/blog/archives/307