//這個方法是自動建立一個Form表單,並指定表單的提交方式是postapp
window.getNewSubmitForm = function()
{
var submitForm = document.createElement("FORM");
document.body.appendChild(submitForm);
submitForm.method = "POST";
return submitForm;
}post
//朝方法1建立的表單裏面動態的建立元素
window.createNewFormElement = function(inputForm, elementName, elementValue)
{
var newElement = document.createElement("<input name='"+elementName+"' type='hidden'>");
inputForm.appendChild(newElement);
newElement.value = elementValue;
return newElement;
}orm
//準備好了,進行提交
window.openPostRequest= function(actionUrl,paras)
{
var submitForm = getNewSubmitForm();
for (i in paras) {
var _propertyName = i.toString();
var _propertyValue = paras[_propertyName];
createNewFormElement(submitForm, _propertyName, _propertyValue);
}
submitForm.action= actionUrl;
submitForm.submit();
}對象
調用方法以下:ci
1: 首先建立一個Object對象,把要建立的元素放到這個對象內element
var object = new Object();
object.queryName = null;
object.updateFlag = null;
object.contentType=contentType;
object.keyWords=keyWords;
object.curStatus=curStatus;
object.spId=spId;
object.name=name;
object.cid=cid;
object.subPloyId=subPloyId;
object.singerName=singerName;
object.province=province;
object.pageSize=pageSize;
object.from=null;
object.to=null; get
2:將元素傳入input
openPostRequest('/mdmc/spOutputOfficeData.cmd',object); cmd