javascript 异步加载URL
|
admin
2010年8月14日 1:13
本文热度 3602
|
javascript 异步加载URL
1
2
3
4
5
6
7
8
9
10
11
12
|
function getJsFile(url, callBack){
var XH = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject('Msxml2.XMLHTTP');
XH.open('get',url,true);
XH.onreadystatechange = function(){
if(XH.readyState == 4 && XH.status == 200){
if(window.execScript) window.execScript(XH.responseText);
else eval.call(window, XH.responseText);
eval(callBack)();
}
}
XH.send('');
} |
该文章在 2010/8/14 1:13:04 编辑过