Я использую JavaScript для отправки формы, которую я делаю с нуля. Код ниже работает в Chrome, но не в Firefox или IE. Как я могу создать и отправить форму, чтобы она работала во всех браузерах?
function someFunction(){
var SomeForm = document.createElement("form");
addInputFieldToForm("SpecialName_SortField","UpdateDate",SomeForm);
addInputFieldToForm("SpecialName_SortOrder","false",SomeForm);
addInputFieldToForm("Operation","Search",SomeForm);
SomeForm.action = "<%=link("direct", "WorkspaceDisplay") %>"; // assume this URL is valid (it is).
SomeForm.method = "post";
SomeForm.target = "_top";
SomeForm.submit();
}
//EDIT: Added this function to the question just so there's less mystery (not because it matters, really)
function addInputFieldToForm(elementName, elementValue, theForm) {
var inputElement = document.createElement("input");
inputElement.name = elementName;
inputElement.value = elementValue;
inputElement.id = elementName;
theForm.appendChild(inputElement);
}