Javascript在Chrome和IE中无效,但在Firefox中有效 [英] Javascript is not working in Chrome and IE but working in Firefox

查看:85
本文介绍了Javascript在Chrome和IE中无效,但在Firefox中有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是javacript代码,它在Mozilla中完美运行但在IE和Chrome中无法正常工作。

Here is the javacript code which is working perfectly in Mozilla but not working perfectly in IE and chrome.

function updateTable(tableID) 
{ 
    alert('inside the update'); 
    var arrayTemp=new Array();
    var str='';
    var arraycount=0;
    try {
        var table = document.getElementById(tableID);
        var rowCount = table.rows.length;

        for(var i=0; i<rowCount; i++) {
            var row = table.rows[i];
            var chkbox = row.cells[4].childNodes[0];                
            if(null != chkbox && true == chkbox.checked) {

           str+=  document.getElementById("flag"+i).value;
           str+=',';
           str+=  document.getElementById("Selected"+i).value;
           str+='`';




            } 

        }
        document.forms[0].updatearray.value=str;
        alert(' value is '+document.forms[0].updatearray.value);
        document.forms[0].submit();

        alert('Checkingdddddd');
    }catch(e) {
        alert(e);
    }
}

此处表格未在IE和Chrome中提交请告诉我有什么补救措施。

Here the forms is not getting submitted in IE and Chrome.Please tell is there any remedy for this.

我测试过并发现document.forms(formname)。submit()仅适用于chrome和IE但是如果我使用document.forms [formname]。提交它不适用于chrome和IE很奇怪,需要一个优秀的javascript魔术师的好建议

I have tested and found that document.forms("formname").submit() is only working for chrome and IE but if I use document.forms["formname"].submit it is not working in chrome and IE quite strange, a good advice from a great javascript magician is needed

推荐答案

我已经找到了补救措施使用document.forms [0] .submit,因为它支持Mozilla,IE和Google Chrome。

I have found out the remedy use document.forms[0].submit as it supports in Mozilla , IE and Google chrome.

答案是:

          Replace:

          document.forms[0].submit();

          To:

          document.forms[0].submit;

这篇关于Javascript在Chrome和IE中无效,但在Firefox中有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆