我是新來的Javascript和Facebook的設計。我正在使用Shortstack創建自定義選項卡,並使用該服務創建了3面板子選項卡應用程序。在第三個小組中,我有19個div的持有信息。默認情況下,我使用CSS來隱藏這些DIV(display:none;),並在面板頂部有一系列鏈接來改變每個DIV onclick的可見性。只有活動的onclick內容隨時可見。Javascript和CSS onclick Div交換
該標籤在Firefox,Chrome甚至是Mac上的Safari瀏覽器中正常運行,但在PC上的所有瀏覽器上都失敗,並且出現不同的失敗。在IE中,交換後立即出現一條錯誤消息,其中提到發佈者不允許在iFrame中執行操作。在Firefox中,該選項卡變爲空白並且沒有錯誤消息。
我的腳本如下。正如我所說的,我是Facebook的新手,並且使用JavaScript,因爲我是一名設計師,而不是程序員,但我渴望學習。
預先感謝您的想法和想法。
function showhide(layer_ref) {
var thisDiv;
// check to see if any DIVs are currently showing
var divlist = ["div1","div2","div3","div4","div5","div6","div7","div8","div9","div10","div11","div12","div13","div14","div15","div16","div17","div18","div19"];
// loop through the list of DIVs in "divlist"
for (x = 0; x < divlist.length; x++) {
thisDiv = document.getElementById(divlist[x]);
// if the DIV is showing, hide it
if (thisDiv.style.display == "block") {
thisDiv.style.display = "none";
}
}
// show the appropriate DIV
thisDiv = document.getElementById(layer_ref);
thisDiv.style.display = "block";
}