HTML 4.01和XHTML 1的id和name属性 [英] id and name attributes of HTML 4.01 and XHTML 1

查看:71
本文介绍了HTML 4.01和XHTML 1的id和name属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在HTML中,name属性可用于元素 a,applet,form,frame,iframe,img和map 。可以在HTML中使用 name 属性和 id 属性来标识文档片段。 XHTML文档必须使用 id 而不是 name 来标识上述元素中的文档片段。实际上,这些元素的 name 属性在XHTML 1.0规范中已被弃用。那么他们如何取代XHTML中的name属性的要求呢?因为对于某些标签,单选按钮等,当从多个单选按钮单击单选按钮时,名称属性将非常有用。那么,XHTML是如何处理这个问题的呢?

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!

推荐答案

在XHTML中,对于< input> 元素(例如单选按钮),name属性不推荐使用。它仅适用于您列出的那些元素。

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.

这篇关于HTML 4.01和XHTML 1的id和name属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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