1.延时脚本运行的方法:
方法一:把全部javascript引用放在<body>元素中,页面内容后,如
<html>
<head>
<title>示例1</title>
</head>
<body>
<!--页面内容-->
<script type="text/javascript" src="example1.js"></script>
<script type="text/javascript" src="example2.js"></script>
</body>
</html>
方法二:为<script>元素定义defer属性defer="defer",如
<html>
<head>
<title>示例1</title>
<script type="text/javascript" defer="defer" src="example1.js"></script>
<script type="text/javascript" defer="defer" src="example2.js"></script>
</head>
<body>
<!--页面内容-->
</body>
</html>