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

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

解决:

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();方法发生混淆造成该错误!! 切记,切记!

时间: 2024-08-25 11:18:46

TypeError: document.formname.submit is not a function的相关文章

js提交表单错误:document.form.submit() is not a function

今天在写JS时,遇上这么个错误:"document.form.submit() is not a function",经过一番搜索,最终找到了修复方法. 这个错误一般是由于表单<form>-</form>中含有name="submit"时,提交时就会有冲突,这个错误常见于按钮上,如: 在Javascript做submit()的时候就会出现冲突,这时将name="submit"改成别的名字就可以了:即使不是按钮,在表单的输入

parent.Menu.document.aspnetForm.submit() 的浏览器兼容性问题

最近在改造升级一个旧的项目,引入jquery 后发现 1 function changeCulture() { 2 var culture = getCookie("PreferredCulture"); 3 4 if (culture == "" || culture == "en-us") 5 culture = "zh-cn"; 6 else 7 culture = "en-us"; 8 9 addC

Uncaught TypeError: this.canvas.getContext is not a function

/**************************************************************************** * Uncaught TypeError: this.canvas.getContext is not a function * 说明: * 使用Gauge.js的遇到这个问题,之前梦真使用的时候直接用div就OK的,目前 * 还不知道为什么这里要用canvas来做才行. * * 2017-3-9 深圳 南山平山村 曾剑锋 *********

ie8下$(document).on(&#39;mouseover mouseout&#39;,&#39;ul li&#39;,function(){})的bug

$(document).on('mouseover mouseout','ul li',function(){ if (event.type == 'mouseover') {           console.log($(this));      }else if(event.type == 'mouseout'){           console.log($(this));      } }); 上述代码在IE8下会console多个结果,在代码末端添加return false可解决问

【jQuery 区别】.click()和$(document).on(&quot;click&quot;,&quot;指定的元素&quot;,function(){});的区别

给出以下的代码展示: 1 //绑定 下一页 的点击事件 2 $("a[aria-label='Next']").click(function(){ 3 $("a[aria-label='Previous']").show(); 4 if(page.pageNo == page.totalPage - 1){ 5 $("a[aria-label='Next']").hide(); 6 }else{ 7 $("a[aria-label='N

Uncaught TypeError: jQuery.i18n.browserLang is not a function

/********************************************************************* * Uncaught TypeError: jQuery.i18n.browserLang is not a function * 说明: * 使用jQuery.i18n.properties.js来做语言自动转换,结果函数无效,读 * 了一下插件源代码,发现已经换掉了接口名称.功能. * * 2017-8-28 深圳 龙华樟坑村 曾剑锋 ********

关于submit与document.form1.submit();这2个提交的区别

首先要知道 一个是按钮提交 一个是在js函数里写代码 document.form1.submit() 提交 区别如下: 从使的方式及效主要有二点区别吧.一.使用submit()提交时,表单中不能存在submit这个按钮,否则提交不成功.二.使用submit()提交时,表单的onsubmit事件将会自动无效,所以有表单验证的表单,也不要用submit()提交,当然你可以将验证代码加在submit()前.其它都完全一样了.总结,除非特殊场合,尽量使用按钮提交. -------------------

TypeError: document.getELementById is not a function

这个错误困扰了我好几个小时,在网上也百度了好久类似的问题但都没有结果,反反复复看了好多遍,才发现,原来是document.getELementById 里面的Element的字母 l 我写成了大写的L...这就是错误原因,希望其他有类似错误的同胞们多加注意了哦

TypeError: matchExpr[type].exec is not a function

遇到了这个问题,很久没找到答案,后来使用了万能的google,貌似也没找到答案. 详细描述下: 通过使用 $(".select")来选择jqeury对象,没问题. 通过$(".select").find(".ccc") 也没问题 通过$(".select").find(".ccc div") 或者 $("select").find("div.ccc") 问题来了,不能