crm动态加载js库

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库,布布扣,bubuko.com

crm动态加载js库

上一篇:用Python自动清理系统垃圾,再也不用360安全卫士了


下一篇:详解#if、#ifdef、#ifndef