请问我下面的三个FORM提交,我不管在哪个DIV中执行操作,最后都返回显示第一个div呢
a.php<html><head><scripttype="text/javascript">functionchangeBody(index){switch(index...
a.php
<html>
<head>
<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>
</head>
<body>
<a href="javascript:changeBody(1)">模块A</a>
<a href="javascript:changeBody(2)">模块B</a>
<a href="javascript:changeBody(3)">模块C</a>
<div id="iDBody1">
<form action="a.php" method="post" name="frm1">
<input type="submit" name="Submit1" value="查询1">
</form>
</div>
<div style="display: none" id="iDBody2">
<form action="a.php" method="post" name="frm2">
<input type="submit" name="Submit2" value="查询2">
</form>
</div>
<div style="display: none" id="iDBody3">
<form action="a.php" method="post" name="frm3">
<input type="submit" name="Submit3" value="查询3">
</form>
</div>
</body>
</html> 展开
<html>
<head>
<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>
</head>
<body>
<a href="javascript:changeBody(1)">模块A</a>
<a href="javascript:changeBody(2)">模块B</a>
<a href="javascript:changeBody(3)">模块C</a>
<div id="iDBody1">
<form action="a.php" method="post" name="frm1">
<input type="submit" name="Submit1" value="查询1">
</form>
</div>
<div style="display: none" id="iDBody2">
<form action="a.php" method="post" name="frm2">
<input type="submit" name="Submit2" value="查询2">
</form>
</div>
<div style="display: none" id="iDBody3">
<form action="a.php" method="post" name="frm3">
<input type="submit" name="Submit3" value="查询3">
</form>
</div>
</body>
</html> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询