日期:2014-05-20  浏览次数:20893 次

回车触发按钮的单击问题,急

page_load

LoginBtn.Attributes.Add( "onkeydown ",   "return       confrm(); ");


js里面

      function       confrm()      
    {      
    if(event.keyCode==13)      
    {      
    document.all.LoginBtn.click();      
    }      
           
       
    }

怎么不触发回车啊,,,
我用的是母版页




------解决方案--------------------
onkeyup
------解决方案--------------------
<SCRIPT>
function checkKey()
{
if (window.event.shiftKey) // checks whether the SHIFT key
// is pressed
{
txtOutput.value = "true "; // returns TRUE if SHIFT is pressed
// when the event fires
}
}
</SCRIPT>
</HEAD>
<BODY>
<P> Press the SHIFT key while pressing another key. <BR>
<INPUT TYPE=text NAME=txtEnterValue onkeypress= "checkKey() ">
<P> Indicates "true " if the shift key is used. <BR>
<INPUT TYPE=text NAME=txtOutput>
</BODY>
------解决方案--------------------
-_-!!!只是给你个例子,你可以写成
this.txtEmail.Attributes.Add( "onkeyup ", "javascript:confrm(); ");