<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY onKeyPress="foo()">
<script>
function foo(){
if(event.keyCode == 27)
alert("Esc key is Pressed");
if(event.ctrlKey && event.keyCode ==26)
alert("ctrl + z");
}
</script>
</BODY>
</HTML>

解决方案 »

  1.   

    cancelBubble Property--------------------------------------------------------------------------------Sets or retrieves whether the current event should bubble up the hierarchy of event handlers. SyntaxHTML N/A 
    Scripting event.cancelBubble [ = bCancel ] Possible ValuesbCancel Boolean that specifies or receives one of the following values:false Default. Bubbling is enabled, allowing the next event handler in the hierarchy to receive the event.  
    true Bubbling is disabled for this event, preventing the next event handler in the hierarchy from receiving the event. 
     The property is read/write. The property has a default value of false.Expressions can be used in place of the preceding value(s), as of Microsoft?Internet Explorer 5. For more information, see Dynamic Properties.ResUsing this property to cancel bubbling for an event does not affect subsequent events. ExampleThis example cancels bubbling of the onclick event if it occurs in the IMG object when the user presses the SHIFT key. This prevents the event from bubbling up to the onclick event handler for the document.<SCRIPT LANGUAGE="JScript">
    function checkCancel()
    {
        if (window.event.shiftKey)
            window.event.cancelBubble = true;
    }
    function showSrc()
    {
        if (window.event.srcElement.tagName == "IMG")
            alert(window.event.srcElement.src);
    }
    </SCRIPT><BODY onclick="showSrc()">
    <IMG onclick="checkCancel()" SRC="sample.gif">
      

  2.   

    <textarea onKeyDown="if(event.keyCode == 27){event.returnValue = false}"></textarea>
    这样按ESC健时输入框的内容不会被清除。
    你问的是这个问题吗?
      

  3.   

    谢谢上面的三位。开始有一个<tr><td><input type="text" name="textfield"></td><td><input type="text" name="textfield1"></td></tr>,按Esc后就会退出所有的,我向按Esc后就把焦点设在<td>里面,而后通过其它处理可以到下一个td。