首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

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

2012-01-12 
回车触发按钮的单击问题,急 page_loadLoginBtn.Attributes.Add( onkeydown ,returnconfrm() )js里面

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

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(); ");

热点排行