Attribute value not allowed on element input at th

2019-07-24 17:22发布

问题:

W3C tells me "Attribute value not allowed on element input at this point". I thought this was necessary for forms?

<input type="image" value="submit" class="no-border" src="assets/images/submit_btn.png" alt="submit" name="submit" /> 

回答1:

http://lists.w3.org/Archives/Public/www-validator/2010May/0025.html

Browsers are inconsistent about sending the value of server side image maps. Some browsers send it, some send only the x/y co-ordinates. It is a very poor idea to depend on it being sent.

[...]

From the draft HTML 5 specification:

The element's value attribute must be omitted.

— http://www.w3.org/TR/html5/states-of-the-type-attribute.html#image-button-state-type-image

So this is not a bug. I assume the attribute was forbidden because common current browsers fail to implement it so that while it would be backwards compatible with HTML 4, it is not compatible with browsers in practice.



标签: forms