将缩小的javascript直接放入HTML中的脚本标记中(Put minified javascript into script tag in HTML directly)

编程入门 行业动态 更新时间:2024-10-28 18:22:44
将缩小的javascript直接放入HTML中的脚本标记中(Put minified javascript into script tag in HTML directly)

我想在HTML页面中直接将缩小的java脚本内容放在标签中。 我有html页面像:

<html> <head> <script src="jquery.js"></script> <script src="iemagic.js"></script> <script src="shim.js"></script> <script src="jszip.js"></script> <script src="xlsx.js"></script> </head> </html>

我已经缩小了所有的javascript内容并将其放在一个名为“all.js”的文件中,并且html工作正常,现在它看起来像:

<html> <head> <script src="all.js"></script> </head> </html>

我想直接在“script”标签中将“all.js”的所有内容包含在HTML中。 我尝试了但没有运气,当我在浏览器中打开html文件时,它显示了我在“script”标签中复制的所有java脚本内容。

还有其他办法吗?

I want to put a minified java script contents in tags directly in HTML page. i have html page like:

<html> <head> <script src="jquery.js"></script> <script src="iemagic.js"></script> <script src="shim.js"></script> <script src="jszip.js"></script> <script src="xlsx.js"></script> </head> </html>

I have minified all the javascript contents and put it in a single file called "all.js" and the html works fine, now it looks like :

<html> <head> <script src="all.js"></script> </head> </html>

I want to include all the content of "all.js" in to HTML directly in "script" tag. I tried with that but no luck, when i open html file in browser it show all the java script content which i have copied in "script" tag.

Is there any other way for this ?

最满意答案

谢谢大家的帮助。 我找到了解决方案。 *添加了所有“js”文件在不同的“脚本”标签测试工作正常,但一些javascript线在浏览器中可见。 *问题是“iemagic.js”有不正确的评论并且正在创建问题。 *我删除了这些注释行,现在正在查找。 没有任何“js”文件和只有一个HTML。 谢谢大家的帮助和宝贵的时间。

Thank you all for helping me. i have found the solution for this. * added all the "js" files in different "script" tag tested working fine but some of the javascript lines was visible in the browswer. * The problem was "iemagic.js" was having the comments which are not proper and was creating the problem. * I have removed those commented lines and is working find now. without having any "js" file and only one HTML. Thank you All for your help and valuable time.

更多推荐

本文发布于:2023-08-05 21:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1438303.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   标记   放入   HTML   javascript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!