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

作者&投稿:冯卖 (若有异议请与网页底部的电邮联系)
在同一个form里面两个按钮 如何提交到不同的action. 前提是用Js解决、~


。。。





function del(){
document.forms.xxxFrom.action="shanchu.action";
document.forms.xxxFrom.submit();
}





RunJS


$(function(){
$("button").click(function(){
var html = "添加一行添加一行"; //自己定义好要添加的信息
$("table").append(html); //添加对应的内容到table
});
});



Hello






这个是简单的例子。。。

<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>