我需要什么事件来苏preSS从&QUOT阻止IE浏览器,卧底"当我preSS在文本框中输入? [英] What event do I need to supress to stop IE from "Dinging" when I press enter in a text box?

查看:175
本文介绍了我需要什么事件来苏preSS从&QUOT阻止IE浏览器,卧底"当我preSS在文本框中输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个文本框pressing简单的表格中输入提交表单(这便于搜索表单是伟大的)

On simple forms with one text box pressing enter submits the form (and this is great for easy search forms)

不过是多个字段,pressing在输入输入=文字框不会做任何事情(如提交),但在IE浏览器丁氏窗体上,如果你试图删除一个不可删除的对象。

However on a form with multiple fields, pressing Enter in an input="text" box won't do anything (e.g. submit) but in IE it "Dings" as if you have tried to delete an undeletable object.

现在的问题是...什么事件,我需要燮在IE preSS停止这种声音?例如如果我有一个用户名/密码的形式,我想回车键提交表单,但我当然不希望的错误的声音。

The question is... what event do I need to suppress in IE to stop this sound? e.g. if I have a username/password form, I DO want the enter key to submit the form, but I certainly don't want the "error" sound.

为例站点的声音:
<一href=\"http://www.sears.com/shc/s/StoreLocatorView?storeId=10153&catalogId=12605\">http://www.sears.com/shc/s/StoreLocatorView?storeId=10153&catalogId=12605
只需preSS中的任何文本字段中输入。丁丁!丁!!

Example site with the sound: http://www.sears.com/shc/s/StoreLocatorView?storeId=10153&catalogId=12605 Just press Enter in any of the text fields. Ding!, Ding!, Ding!

非IE用户,声音是:计划活动> Windows>系统默认的提示音(Windows XP中Ding.wav)

Non-IE users, the sound is the: Program Events > Windows > Default Beep ("Windows XP Ding.wav")

推荐答案

那么看来这个作品:

<!-- suppress sound (and suppress submit) -->
<input type="text" onkeypress="if(window.event.keyCode == 13){return false;}"/>

<!-- suppress sound (BUT allow submit) -->
<input type="text" onkeypress="if(window.event.keyCode == 13){this.form.submit();return false;}"/>

这篇关于我需要什么事件来苏preSS从&QUOT阻止IE浏览器,卧底&QUOT;当我preSS在文本框中输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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