1

这是在 Mozilla 中完美运行但在 IE 和 chrome 中无法完美运行的 javacript 代码。

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 中提交。请告知是否有任何补救措施。

我已经测试过,发现 document.forms("formname").submit() 仅适用于 chrome 和 IE,但如果我使用 document.forms["formname"].submit 它在 chrome 和 IE 中不起作用很奇怪,需要一位伟大的 javascript 魔术师的好建议

4

1 回答 1

2

我发现补救措施使用 document.forms[0].submit 因为它在 Mozilla 、 IE 和 Google chrome 中支持。

答案是:

          Replace:

          document.forms[0].submit();

          To:

          document.forms[0].submit;
于 2012-06-05T11:11:47.787 回答