在文本框中输入事件 [英] Enter event in TextBox

查看:81
本文介绍了在文本框中输入事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题,
在TextBox中键入后,按Enter键.
问题是发回到另一页.
请向我解释!

I have a problem,
After typing in TextBox, I press Enter key.
The problem is post back to another page.
Please Explain me!

推荐答案

请参阅以下文章.它讨论了您想要实现的目标.
http://www.beansoftware.com/ASP.NET-Tutorials/Accept-Enter- Key.aspx [ ^ ]
See following article. It discusses what you want to achieve.
http://www.beansoftware.com/ASP.NET-Tutorials/Accept-Enter-Key.aspx[^]


Enter键是默认的单击事件触发键.尝试使用鼠标单击或禁用Enter键以通过代码触发事件(JavaScript/C#/VB.net等).
Enter key is default click event fire key. Try to use mouse click or disable Enter key to fire event by code(JavaScript/C#/VB.net etc).


hi,

归因于默认行为.

为防止输入按钮事件,请在主体的onkeydown javascript函数上使用此按钮

在javascript函数中使用这些代码


it comes due to the default behaviour.

To prevent the enter button event use this on the onkeydown javascript function from the body

use these code inside the javascript function
if (window.event.keyCode == 13)
{
    event.returnValue=false;
    event.cancel = true;
}



问候,
shefeek



regards,
shefeek


这篇关于在文本框中输入事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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