function includeJS(url){
var me = arguments.callee;
me.Script && me.Script.parentNode.removeChild(me.Script);
me.Script = document.createElement("script");
me.Script.setAttribute("type","text/javascript");
me.Script.src = url;
document.getElementsByTagName("head")[0].appendChild(me.Script);
me.Script.onload = me.Script.onreadystatechange = function(){
if(me.Script.readyState){
if(me.Script.readyState.match(/loaded|complete/i)) return fnback();
}else{
return fnback();
}
}
}
注意:个人测试时发现script元素必须每次重新创建和删除,如果只是在初次加载的页面里事先加入script元素,然后在每次动态加载时只设置src属性则在firefox下不好用。