简体   繁体   English

W3C验证-脚本标签-JavaScript还是其他?

[英]W3C Validation - Script Tag - Javascript or Something else?

I'm getting an bunch of errors in w3c validation because a script tag is missing the type attribute. w3c验证中出现一堆错误,因为脚本标记缺少type属性。 I have 1 left over that I'm not confident what to do with 我剩下1个,我不确定该如何处理

My code that doesn't validate: 我未验证的代码:

<script>
    !window.jQuery && document.write('<script src="/jquery-1.4.3.min.js"><\/script>');
</script>

I've changed it to: 我将其更改为:

<script type="text/javascript">
    !window.jQuery && document.write('<script src="/jquery-1.4.3.min.js"><\/script>');
</script>

I've read that jquery is a framework in javascript, so I'm assuming this is correct above, but is there a different 'type' to use for jquery? 我已经读过jquery是javascript中的框架,因此我假设上面是正确的,但是jquery是否可以使用其他“类型”?

Thans! 坦!

If you are using doctype HTML4/XHTML, the type attribute is required. 如果您使用的是doctype HTML4 / XHTML,则type属性是必需的。

But if you are using doctype HTML5, it's not required. 但是,如果您使用的是doctype HTML5,则不是必需的。

More : W3C Scripts 更多: W3C脚本

Nope, you're right. 不,你是对的。 jQuery is definitely Javascript. jQuery绝对是Javascript。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM