红色字体部分:$('#dealForm')[0].reset();
使用jquery提交表单时,$('#dealForm').reset(); 会提示没有此属性或者方法,必须加上[0];
<html>
<head>
<title>测试字符串</title>
<script src="jquery-1.4.2.min.js"></script>
<script>
function doSubmit1(){
document.getElementById('dealForm').submit();
}
function doReset1(){
document.getElementById('dealForm').reset();
}
function doSubmit2(){
$('#dealForm').submit();
}
function doReset2(){
$('#dealForm')[0].reset();
}
function doChange(index){
alert($("#country").val());
}
</script>
</head>
<body>
<form id="dealForm" action="#;" method="post">
<input type="text" id="custNoInForm" name="custNoInForm"/>
<input type="text" id="productNo" name="productNo"/>
<input type="text" id="flag" name="flag"/>
<input type="text" id="operation" name="operation"/>
<input type="submit" value="提交" />
<input type="reset" value="重置" />
<br/>
<input type="button" value="提交1" onclick="doSubmit1();"/>
<input type="button" value="重置1" onclick="doReset1();"/>
<input type="button" value="提交2" onclick="doSubmit2();"/>
<input type="button" value="重置2" onclick="doReset2();"/>
</form>
<input type="button" value="模板" onclick="openModelSMSWin();" />
<br/>
<select name="country" id="country" onchange="doChange(this.selectedIndex);">
<option value="123">123</option>
<option value="456">456</option>
<option value="789">789</option>
</select>
</body>
</html>