一个表单 不同的标题 点击切换到不同的页面值 用JS怎么写代码 比如 做一个表单如下:

个人贷款申请|企业贷款申请 个人贷款申请表单代码为:<form action="/plus/diy.php" enctype="multipart/form-data" method="post">
<input type="hidden" name="action" value="post" />
<input type="hidden" name="diyid" value="1" />
<input type="hidden" name="do" value="2" />

<table style="width:100%;" cellpadding="0" cellspacing="1">
<tr>
<td width="16%" align="right" valign="top">姓名:</td>
<td width="5%"><input type='text' name='xm' id='xm' style='width:90px' class='intxt' value='' />
</td>

<td width="100%"><input type='radio' name='xb' class='np' value='先生' checked>先生
<input type='radio' name='xb' class='np' value='女士'>女士
</td></tr>

<tr>
<td align="right" valign="top">抵押物:</td>
<td><input type='radio' name='dyw' class='np' value='有' checked>有
<input type='radio' name='dyw' class='np' value='无'>无
</td>
</tr>
<tr>
<td align="right" valign="top">借款金额:</td>
<td><input type='text' name='jkje' id='jkje' style='width:90px' class='intxt' value='' /><td>万元</td>
</td>
</tr>
<tr>
<td align="right" valign="top">联系电话:</td>
<td><input type='text' name='lxdh' id='lxdh' style='width:90px' class='intxt' value='' />
</td>
</tr>
<input type="hidden" name="dede_fields" value="xm,text;xb,radio;dyw,radio;jkje,text;lxdh,text" />
<input type="hidden" name="dede_fieldshash" value="de782a84a0639876d88b31bc07edd4e3" /></table>
<div align='center' style='height:30px;padding-top:10px;'>
<input type="submit" name="submit" value="提 交" class='coolbg' />
 
<input type="reset" name="reset" value="重 置" class='coolbg' />
</div>
</form>
企业贷款申请代码::<form action="/plus/diy.php" enctype="multipart/form-data" method="post">
<input type="hidden" name="action" value="post" />
<input type="hidden" name="diyid" value="1" />
<input type="hidden" name="do" value="2" />

<table style="width:100%;" cellpadding="0" cellspacing="1">
<tr>
<td width="16%" align="right" valign="top">联系人:</td>
<td width="5%"><input type='text' name='xm' id='xm' style='width:90px' class='intxt' value='' />
</td>下面的代码相同

第1个回答  2011-08-28
<style type="text/css">
div.pos_abs
{
position:absolute;
left:10px;
top:48px
}
</style>
<script>
function changeform(whichform)
{
if (whichform<0)
{
document.getElementById("pform").style.visibility="visible";
document.getElementById("cform").style.visibility="hidden";
}
else
{
document.getElementById("pform").style.visibility="hidden";
document.getElementById("pform").style.height="0px";
document.getElementById("cform").style.visibility="visible";
}
}
</script>
<span onclick="changeform(-1);">个人贷款申请</span>
|<span onclick="changeform(0);">企业贷款申请</span>

<div id=pform >
<br>个人贷款申请表单代码为:
<form action="/plus/diy.php" enctype="multipart/form-data" method="post">
<input type="hidden" name="action" value="post" />
<input type="hidden" name="diyid" value="1" />
<input type="hidden" name="do" value="2" />

<table style="width:100%;" cellpadding="0" cellspacing="1">
<tr>
<td width="16%" align="right" valign="top">姓名:</td>
<td width="5%"><input type='text' name='xm' id='xm' style='width:90px' class='intxt' value='' />
</td>

<td width="100%"><input type='radio' name='xb' class='np' value='先生' checked>先生
<input type='radio' name='xb' class='np' value='女士'>女士
</td></tr>

<tr>
<td align="right" valign="top">抵押物:</td>
<td><input type='radio' name='dyw' class='np' value='有' checked>有
<input type='radio' name='dyw' class='np' value='无'>无
</td>
</tr>
<tr>
<td align="right" valign="top">借款金额:</td>
<td><input type='text' name='jkje' id='jkje' style='width:90px' class='intxt' value='' /><td>万元</td>
</td>
</tr>
<tr>
<td align="right" valign="top">联系电话:</td>
<td><input type='text' name='lxdh' id='lxdh' style='width:90px' class='intxt' value='' />
</td>
</tr>
<input type="hidden" name="dede_fields" value="xm,text;xb,radio;dyw,radio;jkje,text;lxdh,text" />
<input type="hidden" name="dede_fieldshash" value="de782a84a0639876d88b31bc07edd4e3" /></table>
<div align='center' style='height:30px;padding-top:10px;'>
<input type="submit" name="submit" value="提 交" class='coolbg' />

<input type="reset" name="reset" value="重 置" class='coolbg' />
</div>
</form>
</div>
<div id=cform style="visibility:hidden" class=pos_abs>
企业贷款申请代码:
<form action="/plus/diy.php" enctype="multipart/form-data" method="post">
<table style="width:100%;" cellpadding="0" cellspacing="1">
<tr>
<td width="16%" align="right" valign="top">姓名:</td>
<td width="5%"><input type='text' name='xm' id='xm' style='width:90px' class='intxt' value='' />
</td>

<td width="100%"><input type='radio' name='xb' class='np' value='先生' checked>先生
<input type='radio' name='xb' class='np' value='女士'>女士
</td></tr>

<tr>
<td align="right" valign="top">抵押物:</td>
<td><input type='radio' name='dyw' class='np' value='有' checked>有
<input type='radio' name='dyw' class='np' value='无'>无
</td>
</tr>
<tr>
<td align="right" valign="top">借款金额:</td>
<td><input type='text' name='jkje' id='jkje' style='width:90px' class='intxt' value='' /><td>万元</td>
</td>
</tr>
<tr>
<td align="right" valign="top">联系电话:</td>
<td><input type='text' name='lxdh' id='lxdh' style='width:90px' class='intxt' value='' />
</td>
</tr>
<input type="hidden" name="dede_fields" value="xm,text;xb,radio;dyw,radio;jkje,text;lxdh,text" />
<input type="hidden" name="dede_fieldshash" value="de782a84a0639876d88b31bc07edd4e3" /></table>
<div align='center' style='height:30px;padding-top:10px;'>
<input type="submit" name="submit" value="提 交" class='coolbg' />

<input type="reset" name="reset" value="重 置" class='coolbg' />
</div>
</form>
</div>本回答被提问者采纳
相似回答