动态引入js文件

var script = document.getElementById('_BHO_JS_');

var head = document.getElementsByTagName('head').item(0);

if(script) {

    head.removeChild(script);

}

var bhoScript = document.createElement('script');

bhoScript.id = '_BHO_JS_';

bhoScript.type = 'text/javascript';

bhoScript.src = 'a.js';

head.appendChild(bhoScript);

你可能感兴趣的:(动态引入js文件)