如何使asp按钮的工作方式与按Enter键时相同. [英] How to make an asp button to work same as when the enter key is pressed.

查看:89
本文介绍了如何使asp按钮的工作方式与按Enter键时相同.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我想了解如何使asp按钮与按Enter键时的作用相同.
我已经设置了UseSubmitBehavior ="true"属性,但这似乎并不能解决问题.
你能请一些选择吗?

谢谢.

hi all

i would like to find out how to make an asp button to work same as when the enter key is pressed.
I have made the UseSubmitBehavior="true" property, but that doesn seem to do the trick.
Can you please some options?

Thanks.

推荐答案

,您可以使用asp:Panel控件的DefaultButton属性.
you can use the DefaultButton property of the asp:Panel control.


尝试一下...

try this...

function CheckKey() 
{ 
var bt = document.getElementById(buttonid);
 
    // checks whether the ENTER key is pressed 
    if (window.event.keyCode == 13) 
    { 
       // act as though the search button was pressed 
      bt .click(); 
    } 
} 



希望它能起作用...



hope it works...


这篇关于如何使asp按钮的工作方式与按Enter键时相同.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆