惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Vercel News
Vercel News
F
Fortinet All Blogs
Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
Blog — PlanetScale
Blog — PlanetScale
H
Help Net Security
B
Blog RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Engineering at Meta
Engineering at Meta
爱范儿
爱范儿
V
Visual Studio Blog
Stack Overflow Blog
Stack Overflow Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
B
Blog
宝玉的分享
宝玉的分享
云风的 BLOG
云风的 BLOG
U
Unit 42
博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
The Cloudflare Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tailwind CSS Blog
S
Schneier on Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
Attack and Defense Labs
Attack and Defense Labs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LangChain Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Hacker News: Ask HN
Hacker News: Ask HN
Jina AI
Jina AI
Schneier on Security
Schneier on Security
W
WeLiveSecurity
Microsoft Security Blog
Microsoft Security Blog
博客园_首页
博客园 - 聂微东

博客园 - Emmet.C

[求助]关于Vsiual Studio.NET 2005中Error List种错误的定位问题 【求助】关于asp.net中的'Thread was being aborted'异常 安装Tomcat 5.0.28备注 如何在运行时定制DataGrid的显示风格? Jbuilder2005安装备注 使用Singleton改善ASP.NET性能备注 Infragistics.WebUI.UltraWebTab.v4.3使用备注 WinForm界面模式 如何定制WebCarlendar类型控件的星期格式 .NET在Debug模式下的编译错误 DataGrid动态绑定 Infragistics UltraWebTab的奇怪问题 架构设计备注(用户以及操作权限管理) 关于通过手机收发短信的相关资源 Read CPU ID(from CSDN) 可用性相关的资料站点 万网企业邮箱开始提供垃圾邮件过滤功能了 为何使用表格排版是不明智的? 申请了GMail
asp.net中如何回车触发指定按钮的事件
Emmet.C · 2005-02-22 · via 博客园 - Emmet.C

问题内容:
在asp.net中,如何回车触发指定按钮的事件?
假设:
<asp:TextBox id="tbInput" runat="server" Width="240px"></asp:TextBox>
<asp:Button id="btnOK" runat="server" BorderWidth="1px" BorderColor="Purple" BorderStyle="Solid" Text="Search Site"></asp:Button>

解决方法:
在.aspx页面中添加:
<SCRIPT LANGUAGE="javascript">
function SubmitKeyClick(button)
{   
 if (event.keyCode == 13)
 {       
  event.keyCode=9;
  event.returnValue = false;
  document.all[button].click();
 }
}
// -->
</SCRIPT>

在Page_Load事件中添加:
tbInput.Attributes.Add("onkeydown","SubmitKeyClick('btnOK');");