答案:使用JQuery来实现
其他:<html>
<head>
<script>
function changeBody($id){
for(j=1;j<=2;j++){
document.getElementById("iDBody"+j).style.display = "none";
}
document.getElementById("iDBody"+$id).style.display = "";
}
function xx($id)
{
document.write('<div>成功了!'+$id+'</div>');
}
</script>
</head>
<body>
<div>
套个循环
<a href="javascript:changeBody(1);">模块A</a>
<a href="javascript:changeBody(2);">模块B</a>
</div>
<div style="display: none" id="iDBody1"><script>javascript:xx(1);
</script>
</div>
<div style="display: none" id="iDBody2"><script>javascript:xx(2);
</script>
</div>
</body>
</html>
上一个:没有css样式怎么改div大小?
下一个:用div嵌套表格符合w3c标准吗?