标签:style blog http color 使用 java ar 2014 div
<script src="../file.js" async="async"></script>
file.js----
仅仅只有alert("hello,world");
async 属性仅适用于外部脚本(只有在使用 src 属性时)。
有多种执行外部脚本的方法:
<html> <head> <script type="text/javascript" src="file.js" async="async"></script> </head> <body> <div style="height:100px;width:100px;background-color:#000000"> </div> </body> </html>
在IE8下执行代码并没有体现异步的功能,执行顺序为:
(1)弹出 hello,world
(2)关闭 "hello,world"后渲染BOM界面
将相同的代码在chorme中进行执行,体现异步特性,即弹出hello,world和渲染浏览器同时进行
关闭【确定】按钮后执行页面如下:
在chorme下的执行结果如下:
标签:style blog http color 使用 java ar 2014 div
原文地址:http://www.cnblogs.com/CBDoctor/p/3952343.html