阻止 IE 突出显示表单中的第一个提交按钮 [英] Stopping IE from highlighting the first submit-button in a form

查看:13
本文介绍了阻止 IE 突出显示表单中的第一个提交按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTML 中似乎未定义在表单中输入的预期行为4.01 规范而 HTML 5 规范 它应该是表单中的第一个提交按钮.

The expected behaviour on enter in a form seems to be undefined in the HTML 4.01 Specification while the HTML 5 specification says it should be the first submit button in the form.

Internet Explorer (IE) 通过添加专有边框或其他东西在表单具有焦点时突出显示表单中的第一个按钮.其他浏览器没有添加这样的视觉线索.

Internet Explorer (IE) highlights the first button in the form when the form has focus by adding a proprietary border or something. Other browsers do not add such a visual clue.

我想使用另一个按钮作为默认按钮并设置此按钮的样式,以便所有浏览器都能提供一个视觉线索,表明它是默认按钮.(我们使用的 ASP.NET 每页使用一个表单,因此很难设计页面以使默认按钮始终排在第一位.)

I'd like to use another button as the default and style this button so all browsers will provide a visual clue that it is the default button. (We're using ASP.NET which uses one form per page, and so it's hard to design the pages so that the default button always comes first.)

虽然我可以在大多数浏览器中使用 javascript 和 css 轻松完成此操作,但我无法让 IE 停止突出显示第一个按钮.

While I can easily accomplish this with javascript and css in most browsers, I'm having trouble making IE stop highlighting the first button.

有什么方法可以告诉 IE 不要突出显示第一个提交按钮或突出显示不同的按钮?还是我错过了其他一些解决方案?

Is there any way to tell IE to NOT highlight the first submit-button or to highlight a different button? Or is there some other solution that I've missed?

推荐答案

在您的 asp.net 按钮控件上,设置 useSubmitBehavior="false".这将 html 呈现为按钮而不是提交.

On your asp.net button control, set useSubmitBehavior="false". That renders the html as a button rather than a submit.

这篇关于阻止 IE 突出显示表单中的第一个提交按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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