以下JavaScript代码在FF和Chrome中工作,但在任何版本的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>
什么是隐藏的?
如果要隐藏元素,则将显示设置为无。
hide
document.getElementById("search_by2_from_row").style.display = "none";
show
document.getElementById("search_by2_from_row").style.display = "inline"; //or "block"
或可见性
hide
document.getElementById("search_by2_from_row").style.visibility = "hidden";
show
document.getElementById("search_by2_from_row").style.visibility = "visible";