gpt4 book ai didi

html - 脚本标记中的 "lang"和 "type"属性有什么区别?

转载 作者:技术小花猫 更新时间:2023-10-29 12:36:00 25 4
gpt4 key购买 nike

对于 <script> HTML 标签,lang=Javascript 之间的技术区别是什么?和 type=text/javascript

我通常两者都用,因为我一直认为旧版浏览器需要其中之一。

最佳答案

根据 HTML 4.01 Spec :

type: This attribute specifies the scripting language of the element's contents and overrides the default scripting language. The scripting language is specified as a content type (e.g., "text/javascript"). Authors must supply a value for this attribute. There is no default value for this attribute.

language: Deprecated. This attribute specifies the scripting language of the contents of this element. Its value is an identifier for the language, but since these identifiers are not standard, this attribute has been deprecated in favor of type.

关于html - 脚本标记中的 "lang"和 "type"属性有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/112482/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com