我已经找到了解决这个问题的所有方法,但一无所获。出于某种原因,当我尝试调用一个函数时,它表示它是未定义的。
function removeBusiness(num){
companies.splice(num, 1); //Removes a company from the companies array.
tabCreate(tabsbody[0]); //Reloads the current tab that you are in.
};
var tabsbody = ["tab_name", "element", 0/*is active*/];
var tabs;
function TabCreate(tab){
switch(tab){
case "contract":
if( tabsbody[2] == 1 ){tabsbody[1].remove(); //Removes old tab page and builds the requested one.
tabs.style.backgroundColor = "#648a64";
}else{ tabsbody[2] = 1;};
if( tabsbody != "contract"){
tabsbody[0] = "contract";
var submain = document.createElement("div");
submain.style.height = "70vh";
submain.style.width = "98%";
submain.style.margin = "auto";
tabsbody[1] = submain;
document.getElementById("main").appendChild(submain);
tabs = document.getElementById("contractlisten");
};
break;
};
};
removeBusiness(0);
这是我的一些代码,但我删除了很多案例,以便于阅读。我在页面加载加3秒后调用removeBusiness。有帮助吗?
答案 0 :(得分:1)
使用资本" T"在致电'TabCreate'功能
<强>更新强>
Javascript区分大小写,http://en.wikipedia.org/wiki/JavaScript_syntax#Case_sensitivity。