form1中嵌套form2,由于form2中有上传控件,想做无刷新上传,但是表单也要能提交。怎么提交上传控件而不刷新页面,代码如下:Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1 id="PageName"></h1>
<!---第1个form-->
<form id="form1" method="post" action="" name="form1">
<table class="tabForm" cellpadding="3" cellspacing="1"> <tr>
<td><span style='color:Red;width:5px;'>*</span>Car.CardNumber</td>
<td><input name='CardNumber' id='CardNumber' value='闽A00' class='ValidateForm' /></td> <td>Car.Name</td>
<td><input name='Name' id='Name' value='' /> </td>
</tr>
<!--上传图片第2个from-->
<form action="/cc/Process" method="post" enctype="multipart/form-data" id="filepost" name="uploadform">
<tr>
<td>Car.Moving</td>
<td>
<div style="display: inline;">
<input type="file" class="buttoncss" name="file1" id="file_Moving" /> <input type="button" onClick="upload('Moving');" value="上传" class="buttoncss" /><label style="color: Red;" id="errorlbl_Moving"></label>
</div>
</td>
<td>Car.Stop</td>
<td>
<div style="display: inline;">
<input type="file" class="buttoncss" name="file2" id="file_Stop"/>
<input type="button" onClick="upload('Stop');" value="上传" class="buttoncss" /><label style="color: Red;" id="errorlbl_Stop"></label> </div>
</td>
</tr>
</form><!--上传图第2个from片-->
<tr>
<td colspan="4" style="text-align:center">
<input type="submit" class="buttoncss" value="提交" />
</td>
</tr>
<!--上传图片-->
</table>
</form>
<!---第1个form-->
</body></html>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1 id="PageName"></h1>
<!---第1个form-->
<form id="form1" method="post" action="" name="form1">
<table class="tabForm" cellpadding="3" cellspacing="1"> <tr>
<td><span style='color:Red;width:5px;'>*</span>Car.CardNumber</td>
<td><input name='CardNumber' id='CardNumber' value='闽A00' class='ValidateForm' /></td> <td>Car.Name</td>
<td><input name='Name' id='Name' value='' /> </td>
</tr>
<!--上传图片第2个from-->
<form action="/cc/Process" method="post" enctype="multipart/form-data" id="filepost" name="uploadform">
<tr>
<td>Car.Moving</td>
<td>
<div style="display: inline;">
<input type="file" class="buttoncss" name="file1" id="file_Moving" /> <input type="button" onClick="upload('Moving');" value="上传" class="buttoncss" /><label style="color: Red;" id="errorlbl_Moving"></label>
</div>
</td>
<td>Car.Stop</td>
<td>
<div style="display: inline;">
<input type="file" class="buttoncss" name="file2" id="file_Stop"/>
<input type="button" onClick="upload('Stop');" value="上传" class="buttoncss" /><label style="color: Red;" id="errorlbl_Stop"></label> </div>
</td>
</tr>
</form><!--上传图第2个from片-->
<tr>
<td colspan="4" style="text-align:center">
<input type="submit" class="buttoncss" value="提交" />
</td>
</tr>
<!--上传图片-->
</table>
</form>
<!---第1个form-->
</body></html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货