且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在另一个页面的一个页面中执行JavaScript写入?

更新时间:2023-01-08 12:59:35

你不能这样做。不是将JavaScript写入页面,而是将其写入.js文件(即:script.js),然后使用脚本标记引用.js文件:

You cannot do this. Instead of writing your JavaScript to a page, write it to a .js file (i.e.: script.js) and then reference the .js file with a script tag:

<script type="text/javascript" src="script.js"></script>