此表单由 JavaScript 生成。它适用于除 IE Edge 和早期版本的 IE 之外的所有浏览器。我对此进行了研究和调查,但没有找到答案。它在测试的所有其他浏览器中都有效,但在 IE 中,提交按钮值为“提交查询”并且无法提交表单。该 javascript 内嵌在标签下方的页面上。我很困惑。非常感谢任何帮助。
/*generate the form itself */
var loginForm = document.createElement("form");
loginForm.setAttribute('id',"editDataForm");
loginForm.setAttribute('method',"post");
loginForm.setAttribute('action',"submit.cfm");
/*some basic text field */
var someTextBox = document.createElement("input");
someTextBox.setAttribute('type',"text");
someTextBox.setAttribute('name',"username");
/*submit button */
var submitThis = document.createElement("input");
submitThis.setAttribute('value',"Submit");
submitThis.setAttribute('type',"submit");
submitThis.setAttribute('name',"SendFormAction");
/*append the textbox to the form */
loginForm.appendChild(someTextBox);
/*append the submit button to the form */
loginForm.appendChild(submitThis);
/*get the div where the form will generate itself */
var loginDiv = document.getElementById("submitFormArea");
/*append the form to the div */
loginDiv.appendChild(loginForm);
最佳答案
根据评论,解决方案是更改此内容:
/*submit button */
var submitThis = document.createElement("input");
submitThis.setAttribute('value',"Submit");
submitThis.setAttribute('type',"submit");
submitThis.setAttribute('name',"SendFormAction");
对此:
/*submit button */
var submitThis = document.createElement("input");
submitThis.setAttribute('type',"submit"); // <-- Set type before value
submitThis.setAttribute('value',"Submit");
submitThis.setAttribute('name',"SendFormAction");
关于javascript - js 提交按钮显示 'submit query' ,不起作用,仅在 IE Edge/IE * 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38619683/