【发布时间】:2011-11-25 18:42:19
【问题描述】:
当我想在 html 标记中 document.getElementById(); 时遇到问题。
示例 =
<html>
<head>
<script type="js"> //note this example is not found so browser is take time to execution
<script type="js"> //note this example is not found so browser is take time to execution
<script type="js"> //note this example is not found so browser is take time to execution
<script type="js"> //note this example is not found so browser is take time to execution
</head>
<body>
<div> ...
<div id="test">
</div>
</body>
</html>
我的问题是如何执行document.getElementById("test"); 而不等待未找到加载脚本?这可以节省更多时间。我该如何解决这个问题。感谢您的回答。
注意:解决不要删除或修改脚本到找到的目录。 以防万一,如果找不到脚本。
【问题讨论】:
标签: javascript html dom