由於公用頁面,但算法不同所以想到此方法切換本但還是無法解決瀏覽器緩存的問題,請指教
load_js("scc","js/box_a.js");
$(".tab").on("click","span",function(){var cls = $(this).attr("id");
for(var i=0;i<$("section").length;i++){
$("section").addClass("box_hide").removeClass("box_show");
}
$(".tab>span").removeClass("high");
$(this).addClass("high");
$("."+cls).addClass("box_show").removeClass("box_hide");
if(cls){
load_js("scc","js/box_"+cls+".js");
}
})
//創建script標籤切換腳本
function load_js(id,url){
var head = document.getElementsByTagName("head").item(0);
_script = document.getElementById(id);
if (_script) {
head.removeChild(_script);
}
var head = document.getElementsByTagName("head").item(0);
_script = document.createElement("script");
_script.setAttribute("src", url);
_script.setAttribute("id", id);
_script.setAttribute("type","text/javascript");
head.appendChild(_script);
return _script;
};