[size=medium][color=red][/color][/size]
http://www.jquerycn.cn/a_11412
http://www.jizhuomi.com/software/535.html
- function include_js(file) {
- var _doc = document.getElementsByTagName('head')[0];
- var js = document.createElement('script');
- js.setAttribute('type', 'text/javascript');
- js.setAttribute('src', file);
- _doc.appendChild(js);
- if (document.all) { //如果是IE
- js.onreadystatechange = function () {
- if (js.readyState == 'loaded' || js.readyState == 'complete') {
- alert('IE6、IE7 support js.onreadystatechange');
- }
- }
- }
- else {
- js.onload = function () {
- alert('Firefox、chrome and others support js.onload');
- }
- }
- }
- include_js('jquery.js');
面加载readyState的五种状态
原文如下:
0: (Uninitialized) the send( ) method has not yet been invoked.
1: (Loading) the send( ) method has been invoked, request in progress.
2: (Loaded) the send( ) method has completed, entire response received.
3: (Interactive) the response is being parsed.
4: (Completed) the response has been parsed, is ready for harvesting.
翻译成中文为:
0 - (未初始化)还没有调用send()方法
1 - (载入)已调用send()方法,正在发送请求
2 - (载入完成)send()方法执行完成,已经接收到全部响应内容
3 - (交互)正在解析响应内容
4 - (完成)响应内容解析完成,可以在客户端调用了