Javascript js提交按钮显示';提交查询';,不起作用,仅在IE边缘/IE中*

Javascript js提交按钮显示';提交查询';,不起作用,仅在IE边缘/IE中*,javascript,forms,internet-explorer,submit,microsoft-edge,Javascript,Forms,Internet Explorer,Submit,Microsoft Edge,让此表单由javascript生成。除了IE Edge和以前版本的IE之外,它在所有浏览器上都能正常工作。我对此进行了研究,但没有找到答案。它在其他每一个测试过的浏览器中都能工作,但在IE中,提交按钮值为“提交查询”,无法提交表单。此javascript内嵌在标记下方的页面上。我被难住了。非常感谢您的帮助 /*generate the form itself */ var loginForm = document.createElement("form"); loginForm.setA

让此表单由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");
/*提交按钮*/
var submitThis=document.createElement(“输入”);

submitThis.setAttribute('type','submit');// 根据评论,解决方案是改变这一点:

/*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");
/*提交按钮*/
var submitThis=document.createElement(“输入”);

submitThis.setAttribute('type','submit');//在
type
之后移动
value
可以解决我的问题。哇。彼此彼此。这非常简单,但也令人困惑。似乎设置
类型会导致元素“重置”。这是有意义的,因为从默认(文本输入)更改为提交(按钮)是一个巨大的变化。在
类型之后移动
可以解决我的问题。哇。彼此彼此。这非常简单,但也令人困惑。似乎设置
类型会导致元素“重置”。这是有意义的,因为从默认(文本输入)更改为提交(按钮)是一个巨大的变化。