Javascript提交函数返回的对象不是函数错误
在最后检查了2个字段之后,我使用此函数提交表单。但是当使用javascript提交表单时,它返回的对象不是函数错误。我没有粘贴这一页的全部代码。粘贴此函数的必填字段。谢谢你的帮助Javascript提交函数返回的对象不是函数错误,javascript,forms,Javascript,Forms,在最后检查了2个字段之后,我使用此函数提交表单。但是当使用javascript提交表单时,它返回的对象不是函数错误。我没有粘贴这一页的全部代码。粘贴此函数的必填字段。谢谢你的帮助 <script type="text/javascript"> function validamt(strval){ var letters = /^[0-9]+(\.[0-9]{1,2})?$/; if (letters.test(strval)) { return true; }
<script type="text/javascript">
function validamt(strval){
var letters = /^[0-9]+(\.[0-9]{1,2})?$/;
if (letters.test(strval)) {
return true;
} else {
return false;
}
}
function validno(strval){
var letters = /^\d+$/;
if (letters.test(strval)) {
return true;
} else {
return false;
}
}
function finalcheck(){
var discount=$("#discount").val();
var stax=$("#stax").val();
var err=0;
if(discount!="In Rupees only" || stax!="(%)"){
if(!validno(stax)){err=1; alert('Invalid Service Tax');$("#stax").focus();}
if(!validamt(discount)){err=1;alert('Invalid Discount Amount');$("#discount").focus();}
}
alert(err);
if(err==0){
try{
document.getElementById('billsetupprocess').action="storebilling.php";
document.getElementById('billsetupprocess').submit();
}
catch(e){
alert(e);
}
}
}
</script>
<form name="billsetupprocess" id="billsetupprocess" method="post" action="storebilling.php" enctype="multipart/form-data" >
<table>
<tr>
<td>Discount</td>
<td><input name="discount" type="text" class="txtclass" id="discount" value="<?php if($discount!=""){echo $discount;} else {echo("In Rupees only");}?>" autocomplete="off" onfocus="Javascript:if(this.value=='In Rupees only'){this.style.color='rgb(193,193,193)';this.value='';}" onblur="Javascript:if(this.value==''){this.style.color='rgb(193,193,193)';this.value='In Rupees only';}" onkeyup="Javascript:if(this.value!=''){this.style.color='rgb(0,133,189)';}"/></td>
<td></td>
<td> </td>
</tr>
<tr>
<td>servicetax</td>
<td><input name="stax" type="text" class="txtclass" id="stax" value="<?php if($discount!=""){echo $servicetax;}else {echo("(%)");}?>" autocomplete="off" onfocus="Javascript:if(this.value=='(%)'){this.style.color='rgb(193,193,193)';this.value='';}" onblur="Javascript:if(this.value==''){this.style.color='rgb(193,193,193)';this.value='(%)';}" onkeyup="Javascript:if(this.value!=''){this.style.color='rgb(0,133,189)';}"/>
</td>
<td></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input name="submit" id="submit" type="button" value="Save Setup" onclick="finalcheck()" class="btnclass" /></td>
<td> </td>
<td> </td>
</tr>
</table>
函数validamt(strval){
变量字母=/^[0-9]+(\[0-9]{1,2})?$/;
if(字母测试(strval)){
返回true;
}否则{
返回false;
}
}
函数validno(strval){
变量字母=/^\d+$/;
if(字母测试(strval)){
返回true;
}否则{
返回false;
}
}
函数finalcheck(){
var折扣=$(“#折扣”).val();
var stax=$(“#stax”).val();
var-err=0;
如果(折扣!=“仅卢比”| |斯塔克斯!=“(%){
如果(!validno(stax)){err=1;alert('Invalid Service Tax');$(“#stax”).focus()}
如果(!validamt(折扣)){err=1;警报('Invalid discount Amount');$(“#discount”).focus()}
}
警惕(err);
如果(错误==0){
试一试{
document.getElementById('billsetupprocess').action=“storebilling.php”;
document.getElementById('billsetupprocess').submit();
}
捕获(e){
警报(e);
}
}
}
优惠
哪一行导致了错误?您能否提供整个HTML PLZIm猜测validno或validamt不是函数…submit()方法一旦遇到,就会触发此错误。所以我用catch去看它。。document.getElementById('billsetupprocess').submit();是触发错误的行。。其余的都是可能的复制品