日期:2014-05-16 浏览次数:20396 次
<script type="text/javascript">
function cc(){
//先隐藏所有表格
var _tables = document.getElementsByTagName('table');
for(var i = 0 ; i < _tables.length ; ++i){
_tables[i].style.display = 'none';
}
_tables[+document.getElementById("aa").value-1].style.display = "block";
}
</script>
<select id="aa" onchange="cc()">
<option value="1">tbl1</option>
<option value="2">tbl2</option>
<option value="3">tbl3</option>
</select>
<table border="1" style="display:none;"><tr><td>table 1</td></tr></table>
<table border="1" style="display:none;"><tr><td>table 2</td></tr></table>
<table border="1" style="display:none;"><tr><td>table 3</td></tr></table>
<script type="text/javascript">
function cc(){
var container = document.getElementById('tables_con');
var v = document.getElementById('aa').value;
if(v){
var tables = container.getElementsByTagName('table');
var len = tables.length;
for(var i=0;i<len;i++){
tables[i].style.display = 'none';
}
document.getElementById('tbl'+v).style.display = 'block';
}
}
</script>
<select id="aa" onchange="cc()">
<option value="1">tbl1</option>
<option value="2">tbl2</option>
<option value="3">tbl3</option>
</select>
<div id="tables_con">
<table id="tbl1" border="1" style="display:none;"><tr><td>table 1</td></tr></table>
<table id="tbl2" border="1" style="display:none;"><tr><td>table 2</td></tr></table>
<table id="tbl3" border="1" style="display:none;"><tr><td>table 3</td></tr></table>
</div>