function load_script(url) {
var xmlHTTPRequest;
if (window.ActiveXObject) {
xmlHTTPRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHTTPRequest = new XMLHttpRequest();
}
else {
xmlHTTPRequest = new ActiveXObject("Msxml2.XMLHTTP");
}
xmlHTTPRequest.open(‘GET‘, url, false);
xmlHTTPRequest.send(‘‘);
eval(xmlHTTPRequest.responseText);
var s = xmlHTTPRequest.responseText.split(/\n/);
var r = /^(?:function|var)\s*([a-zA-Z_]+)/i;
for (var i = 0; i < s.length; i++) {
var m = r.exec(s[i]);
if (m != null) {
window[m[1]] = eval(m[1]);
}
}
}
//事例
load_script("/WebResources/new_rest");
crm动态加载js库
时间: 2024-10-23 20:22:08