我不敢保证它可用,你试试吧!
   document.onKeyDown=notgo;
    function notgo(){
         var w=KeyCode(); 
        if(w==13)
           {
           return false;
             }
         }

解决方案 »

  1.   

    <html><head><script language="JavaScript1.2"><!--
    function netscapeKeyPress(e) {
        if (e.which == 13)
            alert('Enter pressed');
    }function microsoftKeyPress() {
        if (window.event.keyCode == 13)
            alert('Enter pressed');
    }if (navigator.appName == 'Netscape') {
        window.captureEvents(Event.KEYPRESS);
        window.onKeyPress = netscapeKeyPress;
    }
    //--></script></head><body onKeyPress="microsoftKeyPress()"><form name="test">
    <textarea></textarea>
    <input type="text">
    </form></body></html>
      

  2.   

    to skyyoung:
       多谢指教!
       您给出的方法能捕捉到onKeyPress事件,但怎样处理
    才能在inputtext回车的时候整个页面不被重新装载呢?
      

  3.   

    How do I prevent IE3 from submitting a form when the user presses enter in a field? Creating a dummy form with a single hidden field will correct this bug. 
    =========================================================================
    Is it possible to stop Microsoft Internet Explorer 4 submitting a form when enter is pressed? Try: <script language="JavaScript"><!--
    if (document.layers) document.captureEvents( Event.KEYPRESS);
    window.onkeypress = keyhandler;
    function keyhandler(e) {
       var event = e ? e : window.event;
       if (event.keyCode == 13) return false;
    }
    //--></script><form name="myForm" onSubmit="alert('submitted'); return false;">
    <input type="text" name="field1" onKeyPress=keyhander(e)">
    <input type="text" name="field2" onKeyPress=keyhander(e)">
    </form> 
      

  4.   

    INPUTTEXT有回车时,将焦点转出INPUTTEXT。
      

  5.   

    to skyyoung:
      
      试了您在2001-2-2 给出的方法inputtext回车的时候整个页面不被重新装载
    但整个页面对其他事件也没有了反应。我的目的是当回车的时候整个页面不被重
    新装载但想在onKeyPress中执行其他的函数请问如何实现呢?
      

  6.   

    你可以试试这个方法:
    <html>
    <head>
    <title>提交</title>
    <script>
    function check()
    {
       if(document.forms[0].gosubmit=="1")
         return true;
       else
         return false;
    }
    function submitok()
    {
       document.forms[0].gosubmit="1"
       document.forms[0].submit()
    }
    </script>
    </head>
    <body>
    <form action="a.asp" method="post" onsubmit="return(check())">
    <input type="hidden" name="gosubmit" value="0">
    <input type="text" name="msg" value="0">
    <input type="button" value="提交" onclick="submitok()">
    </form>
    </body>
    </html>这个方法的好处是不需要每一个文本框都要加上onkeypress事件,改动原来的内容很少
      

  7.   

    打错.
    document.forms[0].gosubmit=="1"应该改为这样document.forms[0].gosubmit.value=="1"