Javascript提交表单未在Firefox和IE中提交
Javascript submit form not getting submitted in Firefox and IE
我正在用javascript向C#MVC中的控制器提交一个表单,它在chrome中很容易提交,但在Firefox和IE 中则不然
//CSHTML CODE
<th class="gen2">
<button type="button" id="buttonClass">Generate</button>
</th>
<td class="money"><input type="checkbox" class="chk" name="checkboxID" value=@item.WithdrawalID></td>
//Javascript code
$("#buttonClass").click(function () {
getValueUsingClass();
});
function getValueUsingClass() {
var data = "";
var submitForm = document.createElement('form');
//Creating a form and giving the attributes
submitForm.name = "formSubmit";
submitForm.id = "formSubmit";
submitForm.method = "post";
submitForm.action = "generatebankfile";
var chkArray = '['];
alert(chkArray);
$(".chk:checked").each(function () {
chkArray.push($(this).val());
});
for (var i = 0; i < chkArray.length; i++) {
data = data + chkArray'[i'];
if (i != chkArray.length - 1) {
data = data + ',';
}
}
var element = document.createElement("input");
element.name = "checkboxID";
element.value = data;
submitForm.appendChild(element);
if (chkArray.length > 0) {
submitForm.submit();
}
else {
alert("Please select at least one of the checkbox");
}
}
将表单附加到主体
document.getElementsByTagName('body')[0].appendChild(submitForm);
相关文章:
- 当在coldfusion中通过AJAX传递时,FORM提交在IE浏览器中给出空表单
- jquery表单提交无法使用多个输入(IE和Firefox)
- writeln img src将数据提交到外部系统-Firefox和IE挂起
- 图片上传无法在IE中工作,表单未提交
- 表单提交后用Javascript更新表-在IE&边
- 提交输入不'不要在IE和Firefox中发布
- 为什么在IE和Chrome中提交表单不起作用
- 如何在IE手机版中绑定按键代码提交按钮
- j查询表单在IE中文件输入更改时自动提交
- 此代码阻止我的表单提交(仅在 chrome 中,适用于 IE 和 Firefox)
- 表单提交 - IE 访问被拒绝 - 同一域
- 输入类型提交的 IE 问题
- 不需要的文件在IE中提交后清除文本框
- 提交图像按钮的焦点在IE 8中未突出显示
- Ajax在Chrome / Safari中提交作品,但不能在Firefox / IE中提交作品
- IE 8-9 SCRIPT5:提交时Zugriff verweigert(访问被拒绝)
- 如何避免在非IE浏览器中使用pushState和$.ajax(hash)进行双重提交
- 另一种方法是让chrome、IE 8和firefox提交相同的表单
- 如何在IE中提交Anchor Javascript.在FF、Chrome和Safari中工作
- Javascript表单未按预期在IE上提交