首页 > 代码库 > 哪种写法更好?<script></script> vs/or <script type=”text/javasript”></script>

哪种写法更好?<script></script> vs/or <script type=”text/javasript”></script>

一直很奇怪 哪种写法更好<script type=“text/javascript”>…</script> or <script>…</script>?

大致解释就是 如果用H5 就不需要加,因为H5默认属性就是text/javascript,

而 HTML 4.01 and XHTML 1.0 规范 type 属性是需要的,如果用H5<script>...</script> 是可以且比较好的选择。

 

技术分享

 

参考:http://stackoverflow.com/questions/4243577/which-is-better-script-type-text-javascript-script-or-script-scr

哪种写法更好?<script></script> vs/or <script type=”text/javasript”></script>