外部 .js 文件是否需要 <script>标签? [英] Does an external .js file require <script> tags?

查看:19
本文介绍了外部 .js 文件是否需要 <script>标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

外部 .js 文件是否需要内部和包含标签才能工作?

Does an external .js file require internal and containing tags to work?

推荐答案

不,它们不是必需的,实际上如果包含它们会出现语法错误.

No, they're not needed, in fact you'll get a syntax error if you include them.

您的 .js 文件应包含 JavaScript,其周围没有 HTML 标记,就像在页面内一样.

Your .js files should contain only JavaScript, no HTML tags around it, like would have inside a page.

这篇关于外部 .js 文件是否需要 <script>标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆