<script>function getValSelect(val) {
var idServer = val.value;
var listServer = ["1", "2", "3", "4"]; // danh sach gia tri option[value] và div[id] cho tung server
// an tat ca server khong duoc chon
for(var index in listServer){
if(listServer[index] == idServer){
document.getElementById(listServer[index]).style.visibility = "visible";
document.getElementById(listServer[index]).style.display = "block";
}else{
document.getElementById(listServer[index]).style.visibility = "hidden";
document.getElementById(listServer[index]).style.display = "inline";
}
}
}
</script>
<style>
.hide{visibility:hidden;display:inline;}
</style>
<select id="listSelect" onchange="getValSelect(this)">
<option value="1">Server 1</option>
<option value="2">Server 2</option>
<option value="3">Server 3</option>
<option value="4">Server 4</option>
</select>
<!-- danh sach hien thi mac dinh -->
<div id="1">Danh sach Server 1</div> <!-- hien server 1 -->
<div id="2" class="hide">Danh sach Server 2</div> <!-- an server 2 -->
<div id="3" class="hide">Danh sach Server 3</div> <!-- an server 3 -->
<div id="4" class="hide">Danh sach Server 4</div> <!-- an server 4 -->