admin管理员组文章数量:1335847
Basically this is the question. Which is the difference between these two statements:
language
<script language="javascript" src="_js/calendar/calendar.js"></script>
text/javascript
<script type="text/javascript" src="_js/calendar/calendar.js"></script>
Basically this is the question. Which is the difference between these two statements:
language
<script language="javascript" src="_js/calendar/calendar.js"></script>
text/javascript
<script type="text/javascript" src="_js/calendar/calendar.js"></script>
Share
Improve this question
asked Sep 5, 2012 at 7:47
Daniel Ramirez-EscuderoDaniel Ramirez-Escudero
4,04713 gold badges46 silver badges81 bronze badges
2
- nothing really. they both run & execute. – user1251600 Commented Oct 6, 2012 at 5:33
- Just because they both currently run and execute doesn't mean they have no difference – Ben Taliadoros Commented Apr 25, 2013 at 9:03
3 Answers
Reset to default 6Per the 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.
Language is generally used to indicate the Javascript version that your script requires. Browsers that support the language attribute won't load or run the script if it doesn't support it. About the only use would be if you had critical Javascript functions where you needed workarounds for older browsers.
The language = JavaScript
suggests that the language formatting and error-checking is to be based on JavaScript standards. The type = text/javascript
only suggests that the inner contents' formatting will be text, in JavaScript form.
But language = JavaScript
is deprecated anyway, so don't worry.
Taking a look at W3 language
should have been deprecated or removed :
<!ELEMENT SCRIPT - - %Script; -- script statements -->
<!ATTLIST SCRIPT
charset %Charset; #IMPLIED -- char encoding of linked resource --
type %ContentType; #REQUIRED -- content type of script language --
src %URI; #IMPLIED -- URI for an external script --
defer (defer) #IMPLIED -- UA may defer execution of script --
>
本文标签: jquerydifference between typetextjavascript and languagejavascriptStack Overflow
版权声明:本文标题:jquery - difference between type=textjavascript and language=javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742400344a2467762.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论