日期:2014-05-18 浏览次数:20790 次
<script> function show(){ document.getElementById("div1").style.display="none";//不显示 document.getElementById("div2").style.display="block";//显示 } </script> <div id="div1"> <form name="form1"> </form> </div> <div id="div2"> <form name="form2"> </form> </div>
------解决方案--------------------
我都调试通过了,其他细节你自己写吧
<html>
<head>
<title></title>
<script language="javascript" type="text/javascript">
function change(){
var r=document.getElementById("radiogroup").children;
for(var i=0;i<r.length;i++){
if(r[i].checked==false)
document.forms[i].style.display="none";
else document.forms[i].style.display="inline";
}
}
</script>
</head>
<body>
<form action="" method="get" id="1" style="display:none;">
<label>表单1</label>
<input type="text">
<input type="text">
<input type="button" value="表单1">
</form>
<form action="" method="get" id="2" style="display:none;">
<label>表单2</label>
<input type="text">
<input type="button" value="表单2">
</form>
<form action="" method="get" id="3" style="display:none;">
<label>表单3</label>
<input type="text">
<input type="button" value="表单3">
</form>
<div id="radiogroup">
<input type="radio" name="sizes" onclick="change();">
<input type="radio" name="sizes" onclick="change();">
<input type="radio" name="sizes" onclick="change();">
</div>
</body>
</html>
------解决方案--------------------
上面的有个地写错了,下面的正确,写快了
我都调试通过了,其他细节你自己写吧
<html>
<head>
<title></title>
<script language="javascript" type="text/javascript">
function change(){
var r=document.getElementById("radiogroup").children;
for(var i=0;i<r.length;i++){
if(r[i].checked==false)
document.forms[i].style.display="none";
else document.forms[i].style.display="inline";
}
}
</script>
</head>
<body>
<form action="" method="get" id="1">
<label>表单1</label>
<input type="text">
<input type="text">