id and name attributes of HTML 4.01 and XHTML 1

对着背影说爱祢 提交于 2019-12-08 10:08:58

问题


In HTML, the name attribute may be used for the elements a, applet, form, frame, iframe, img, and map. The name attribute and the id attribute may be used in HTML to identify document fragments. XHTML documents must use id instead of name for identifying document fragments in the aforementioned elements. In fact, the name attribute for these elements has been deprecated in the XHTML 1.0 specification. Then how do they replace the requirement of name attribute in XHTML? Because, for some tags, radio buttons, etc, name attribute will be useful, when a radio button clicked from multiple radio buttons. So, how does XHTML handle this?

Thanks!


回答1:


The name attribute is not deprecated for <input> elements (such as radio buttons) in XHTML. It's only deprecated for those elements that you list.



来源:https://stackoverflow.com/questions/4665890/id-and-name-attributes-of-html-4-01-and-xhtml-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!