您的位置:首页 > 其它

buttons need type="submit" to submit in IE

2010-07-07 15:10 411 查看
In a typical round of doing Internet Explorer clean up at the end of a
project, I had to figure out why my
<button>Submit</button>

wasn't submitting a form in IE.

I did a search on "html button" and went to the w3c HTML
4.01 specifications
:

type = submit|button|reset [CI]

This attribute declares the type of the button. Possible values:

submit: Creates a submit button. This is the default value.

reset: Creates a reset button.

button: Creates a push button.

So the default is submit. But Internet Explorer has obviously
forgotten this in IE6 and IE7. I found it worked without type="submit"
in Firefox, Safari, Chrome and Opera. I haven't tested in IE8 because I
don't have it installed. Maybe someone wants to check it out? Here
is a demo page.

So I guess we should get in the habit of using:

<button type="submit">Submit</button>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐