<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>div隐藏与显示</title>
<script type="text/javascript">
function changeBody(index){
switch(index){
case 1:{
document.getElementById(‘iDBody1‘).style.display = "";
document.getElementById(‘iDBody2‘).style.display = "none";
document.getElementById(‘iDBody3‘).style.display = "none";
break;
}
case 2:{
document.getElementById(‘iDBody1‘).style.display = "none";
document.getElementById(‘iDBody2‘).style.display = "";
document.getElementById(‘iDBody3‘).style.display = "none";
break;
}
case 3:{
document.getElementById(‘iDBody1‘).style.display = "none";
document.getElementById(‘iDBody2‘).style.display = "none";
document.getElementById(‘iDBody3‘).style.display = "";
break;
}
}
}
</script>
<a href="javascript:changeBody(1)">模块A</a>
<a href="javascript:changeBody(2)">模块B</a>
<a href="javascript:changeBody(3)">模块C</a>
<div style="display: none" id="iDBody1">模块A</div>
<div style="display: none" id="iDBody2">模块B</div>
<div style="display: none" id="iDBody3">模块C</div>
</body>
</html>