<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>DIV-3</title>
<style type="text/css">
.hiddiv {display:none}
</style>
<SCRIPT language=JavaScript>
<!--
function a(x){
for( i=0; i<divLen; i++ ){
if(allDiv
[i].className=="hiddiv")
allDiv
[i].style.display = "none"
if(allDiv
[i].id=="div"+x)
allDiv
[i].style.display = "block"
}
}
window.onload = function(){
allDiv = document.getElementsByTagName("div");
divLen = allDiv.length
}
-->
</SCRIPT>
</head>
<body>
<div id="div1" class="hiddiv" style="display:block">此处显示 id "div1" 的内容</div><br>
<div id="div2" class="hiddiv">此处显示 id "div2" 的内容</div><br>
<div id="div3" class="hiddiv">此处显示 id "div3" 的内容</div><br>
<div id="div4" class="hiddiv">此处显示 id "div4" 的内容</div><br>
<select onChange="a(value)">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</body>
</html>
posted on 2006-08-01 15:31
kelven 阅读(5806)
评论(2) 编辑 收藏 所属分类:
JavaScript