TypeError: document.formname.submit is not a function

<form name="formname" ...>

   ....

     <input name="submit" type="submit" class="dd" value="统计" />&nbsp;&nbsp;
            <input name="button1" type="button" class="buttonBg" onclick="aaa(1)" value="按仓库统计报表" />

</form>

<script type="text/javascript">
    function aaa(value){
        //alert(value);
        if(value == 1){
            document.formname.action = '/login.htm';
            document.formname.submit();
        }
    }
</script>

TypeError: document.echartForm.submit is not a function

这里提交的时候,出现了:

TypeError: document.formname.submit is not a function

解决:

Javascript Error: submit is not a function
有时候需要用javascript提交表单,这个时候我们会用javascript:document.formname.submit();可是我在这样做的时候怎么也提交不成功,报出javascript错误Javascript Error: submit is not a function。百思不得其解,后来查阅资料才发现,在用 document.formname.submit();提交表单的时候,表单里面不能有name="submit"的元素,否则在提交的时候,该对象会和submit();方法发生混淆造成该错误!! 切记,切记!

原文地址:https://www.cnblogs.com/gmq-sh/p/4285316.html