2013-04-24 61 views
0
<tr style="height:5px" id="TRRSHeaderTrialBar" name="TRRSHeaderTrialBar" style='display:none'> 
<tr id="TREmail" name="TREmail" style="height:1px;" nowrap style='display:none'> 

我使用上面的代碼隱藏欄並將其工作正常在IE中而不是在Firefox和鉻 所以我用顯示:無屬性在Firefox不工作和鉻

document.getElementById("TREmail").style.display = "none"; 
document.getElementById("TRRSHeaderTrialBar").style.display = "none"; 

TRRSHeaderTrialBar包含標籤頁和TREmail包含兩個按鈕。 頁面加載時,TRRSHeaderTrialBar工作正常,但TREmail顯示頁面開始加載時的按鈕。加載完成後,它隱藏。

我想在頁面加載時隱藏那些按鈕。

+5

您的標記無效:[在同一個開始標記中,它們的名稱不區分大小寫匹配。](http://www.w3.org/TR /html-markup/syntax.html#attribute) – Zeta 2013-04-24 11:38:15

+0

爲什麼你有2次風格 – DiederikEEn 2013-04-24 11:49:43

回答

4

must not使用多個樣式屬性。取而代之的

<tr style="height:5px" ... style='display:none'> 

使用

<tr style="height:5px; display:none"> 
+0

嗨感謝您的即時回覆,它工作正常。 – 2013-04-24 12:15:40

0

看看你寫的HTML代碼;你可以很容易地注意到在tr中有兩種樣式。 嘗試之後,它可能工作:

<tr style="height:5px; display:none;" id="TRRSHeaderTrialBar" name="TRRSHeaderTrialBar"> 
<tr id="TREmail" name="TREmail" style="height:1px; display:none;" nowrap> 

您必須應用所有的CSS樣式的一種樣式的標題,如上面的代碼中提到。

0
varvalidated = document.forms(0).validated.value; 

if(varvalidated == 0) 
{ 
    document.getElementById("k1").style.display = "none"; 
} 
else 
{ 
    document.getElementById("t1").style.display = "none"; 
} 
+2

添加一些說明和代碼格式以提高可讀性。 – 2017-12-04 05:58:39

相關問題