2012-11-07 74 views
0

以下JavaScript代碼在FF和Chrome中工作,但在任何版本的IE中。似乎沒有任何明顯的錯誤,我可以找到。Javascript IE衝突

任何幫助將不勝感激。

<script type="text/javascript"> 
// hide/expose search_by2 to/from dates 
function hide_search_by2(that){ 
    selected_value = that.options[that.selectedIndex].value; 

    if(selected_value == 'vehicles_sales.nodate'){ 
     document.getElementById("search_by2_from_row").hidden=true; 
     document.getElementById("search_by2_to_row").hidden=true; 
    } else { 
     document.getElementById("search_by2_from_row").hidden=false; 
     document.getElementById("search_by2_to_row").hidden=false; 
    } 
} 
</script> 
+0

什麼SELECTED_VALUE包含在IE瀏覽器? – m02ph3u5

+0

嗨,它返回「vehicles_sales.nodate」 –

+0

並確實#search_by2_from_row有一個屬性隱藏? – m02ph3u5

回答

1

什麼是隱藏的?

如果要隱藏元素,請將display設置爲none。

隱藏

document.getElementById("search_by2_from_row").style.display = "none"; 

顯示

document.getElementById("search_by2_from_row").style.display = "inline"; //or "block" 

或知名度

隱藏

document.getElementById("search_by2_from_row").style.visibility = "hidden"; 

顯示

document.getElementById("search_by2_from_row").style.visibility = "visible"; 
+0

顯示不同於隱藏的 然而早期的IE似乎不喜歡'隱藏' – m02ph3u5

+1

沒有'display:hidden'這樣的東西。但是'display:none'是有效的。 – slebetman

+0

嗨,這工作時,我使用顯示:無slebetman建議。請更新您的答案,我會接受:) –