基本上就是这个问题。这两个语句之间的区别是什么:
语言
<script language="javascript" src="_js/calendar/calendar.js"></script>
文本/javascript
<script type="text/javascript" src="_js/calendar/calendar.js"></script>
最佳答案
根据 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.
语言通常用于指示您的脚本需要的 Javascript 版本。支持语言属性的浏览器如果不支持则不会加载或运行脚本。唯一的用途是如果你有关键的 Javascript 功能,你需要针对旧浏览器的解决方法。
关于javascript - type=text/javascript 和 language=javascript 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12276803/