html – 脚本标签中的“lang”和“type”属性有什么区别?

前端之家收集整理的这篇文章主要介绍了html – 脚本标签中的“lang”和“type”属性有什么区别?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
对于< 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.

原文链接:https://www.f2er.com/html/230256.html

猜你在找的HTML相关文章