按回车使一个button触发,如何实现。 用javascript写,后台并不知道什么时候按了回车。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 只需要在form的InitializeComponent()函数中加一句话就可以了this.Enter += new System.EventHandler(this.button1_Click); javascript写或者在C#中有registerclientblock发送到前台,也可以 最简单的就是当你敲回车的时候吧focus放到那个按钮上。回车的code是13 如果是B/S结构,并且是在当前页面,用JAVASCRIPT实现。 <input onkeydown="gosub()" type="text">javascript:function gosub(){ if( event.keyCode == 13 ) { document.all.Button1.click(); }} <input onkeydown="gosub()" type="text">javascript:function gosub(){ if( event.keyCode == 13 ) { document.all.Button1.click(); }} stoway(X.G.Z)正确。也可以这样。<input type="text" id="txt1" onkeydown="javascript:if (event.keyCode==13) {document.all.btnQuery.click();return false;}"><input type="button" id="btnQuery" name="Button1" value=" 查 询 ">enjoy! CTS,CLS 和 CLR 分别作何解释? 关于C# Socket连接的问题`` 输入框数字计算 DataGridView 的CellErrorTextNeeded事件问题 p2p文件下载 怎么用winrar解压缩我的rar文件 郁闷一下,问个算法的问题 如何在DataGrid中不显示指定列中的重复值? 主线程外的另一个线程弹出的对话框怎么不是模态的? 能不能帮我看一下这个问题怎么解决? 自认为是牛人的请进 ActiveReport For Vs.Net好用吗?
this.Enter += new System.EventHandler(this.button1_Click);
javascript:
function gosub()
{
if( event.keyCode == 13 )
{
document.all.Button1.click();
}
}
javascript:
function gosub()
{
if( event.keyCode == 13 )
{
document.all.Button1.click();
}
}
<input type="text" id="txt1" onkeydown="javascript:if (event.keyCode==13) {document.all.btnQuery.click();return false;}">
<input type="button" id="btnQuery" name="Button1" value=" 查 询 ">enjoy!