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;