且构网

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

HTML解析顺序/脚本执行顺序

更新时间:2022-05-14 03:10:53

脚本按照它们在文档中的顺序执行.浏览器在执行脚本之前先等待脚本加载.

The scripts are executed in the order they are in the document. The browser waits for the script to load before executing the scripts following it.

如果不是这种情况,则不能有两个文件相互依赖.您必须将所有内容都放在同一个文件中,否则脚本执行顺序实际上是随机的.

If this weren't the case, you couldn't have any two files be dependent of each other. You'd have to put everything in the same file because otherwise the script execution order would be practically random.