function getQuery(form){
//将表单元数拼成Query条件 queryString=""; var numberElements =
form.elements.length; for(var i = 0; i <
numberElements; i++) {
if(i
queryString += form.elements[i].name+"="+
encodeURI(encodeURI(form.elements[i].value))+"&";
} else {
queryString += form.elements[i].name+"="+
encodeURI(encodeURI(form.elements[i].value));
}
} return queryString;
}
function sendGetForm(form,myStateChanged){ //表单GET提交 var queryString = getQuery(form); var url = form.action; url =
url+"?"+queryString+"&sid="+Math.random(); sendGetAction(url,myStateChanged);
}
function sendPostAction(url,strQuery,myStateChanged){
//post传送
if (xmlHttp==null) { xmlHttp=GetXmlHttpObject(); } xmlHttp.open("POST",url,true); xmlHttp.Onreadystatechange=myStateChanged;
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); xmlHttp.send(strQuery);//发送请求
};
function sendPostForm(form,myStateChanged){
//表单post提交 var queryString = getQuery(form); var url = form.action; sendPostAction(url,queryString,myStateChanged);