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>
最后
以上就是粗犷音响最近收集整理的关于javascript学习笔记(一) 在html中使用javascript的全部内容,更多相关javascript学习笔记(一)内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复