【发布时间】:2018-04-25 08:08:12
【问题描述】:
当下面的代码按照编写的顺序执行时,为什么alert仍然在第2行呢?谢谢!
document.write ("Hello World");
alert("You wrote to the document!");
【问题讨论】:
-
评论已删除
-
停止这样的评论
-
文档的构建比文件的“解析”花费的时间更长,这就是为什么在构建页面之前执行警报的原因。您需要等到文件准备好。见javascript-that-executes-after-page-load
标签: javascript