Javascript提交函数返回Object不是函数错误

时间:2014-04-15 13:11:58

标签: javascript forms

在最后一次检查2个字段后,我正在使用此功能进行表单提交。但是当使用javascript提交表单时,它返回的Object不是函数错误。没有粘贴这个页面的整个代码。粘贴此功能的必填字段。任何帮助赞赏

<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>&nbsp;</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>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="submit" id="submit" type="button" value="Save Setup" onclick="finalcheck()" class="btnclass" /></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

0 个答案:

没有答案