Function createhttprequest (){
VaR httprequest = false;
If (window. XMLHttpRequest)
{// If Mozilla, Safari etc
Httprequest = new XMLHttpRequest ();
If (httprequest. overridemimetype)
Httprequest. overridemimetype ('text/xml ');
}
Else if (window. activexobject)
{// If IE
Try {
Httprequest = new activexobject ("msxml2.xmlhttp ");
}
Catch (e ){
Try {
Httprequest = new activexobject ("Microsoft. XMLHTTP ");
}
Catch (e ){}
}
}
Return httprequest;
}
Function createxml (STR ){
If (document. All ){
VaR xmldom = new activexobject ("Microsoft. xmldom ")
Xmldom. loadxml (STR)
Return xmldom
}
Else
Return new domparser (). parsefromstring (STR, "text/XML ")
}
Function showschedule (SID, f ){
VaR url = "../schedule. do? Operate = tofindbyid ";
VaR poststr = "uid =" + encodeuri (SID );
// Questions about frequent data transmission initialization in IE
Httprequest. Open ("Post", URL, true );
Httprequest. onreadystatechange = function (){
If (httprequest. readystate = 4)
If (httprequest. Status = 200 ){
VaR xml = createxml (httprequest. responsetext );
VaR item = xml. getelementsbytagname ("Schedule") [0];
VaR scheduleid = item. getelementsbytagname ("scheduleid") [0]. firstchild. nodevalue;
VaR Title = item. getelementsbytagname ("title") [0]. firstchild. nodevalue;
VaR schcontent = item. getelementsbytagname ("schcontent") [0]. firstchild. nodevalue;
VaR address = item. getelementsbytagname ("Address") [0]. firstchild. nodevalue;
VaR ifprivate = item. getelementsbytagname ("ifprivate") [0]. firstchild. nodevalue;
VaR createtime = item. getelementsbytagname ("createtime") [0]. firstchild. nodevalue;
VaR begintime = item. getelementsbytagname ("begintime") [0]. firstchild. nodevalue;
VaR endtime = item. getelementsbytagname ("endtime") [0]. firstchild. nodevalue;
VaR meetingid = item. getelementsbytagname ("meetingid") [0]. firstchild. nodevalue;
F. scheduleid. value = scheduleid;
F. Title. value = title;
F. Address. value = address;
F. meetingid. value = meetingid;
F. schcontent. value = schcontent;
If (ifprivate = 0)
F. ifprivate. Checked = true;
Else
F. ifprivate. Checked = false;
F. begintime. value = begintime;
F. endtime. value = endtime;
F. Option. value = "domodify ";
}
}
Httprequest. setRequestHeader ("Content-Type", "application/X-WWW-form-urlencoded ");
Httprequest. Send (poststr );
}
==========================================
Dom4j-1.6.1.jar
Import org. dom4j. Document;
Import org. dom4j. documenthelper;
Import org. dom4j. element;
Document Doc = incluenthelper. createdocument ();
Element Node = Doc. addelement ("depart ");
Element departid = node. addelement ("departid ");
Departid. settext (item. getdepartid (). tostring ());
Element branchid = node. addelement ("branchid ");
Branchid. settext (item. getbranchid (). tostring ());
Element Extension name = node. addelement ("extension name ");
Registrant name. settext (item. getpipeline name ());
Element principaluserid = node. addelement ("principaluserid ");
Principaluserid. settext (item. getprincipaluserid (). tostring ());
Element connecttelno = node. addelement ("connecttelno ");
Connecttelno. settext (item. getconnecttelno ());
Element connectmobiletelno = node. addelement ("connectmobiletelno ");
Connectmobiletelno. settext (item. getconnectmobiletelno ());
Element faxes = node. addelement ("faxes ");
Faxes. settext (item. getfaxes ());
Printwriter out = response. getwriter ();
Out. println (Doc. asxml ());
Out. Flush ();
Out. Close ();
======================================
Request. setcontenttype ("text/XML ");
Httprequest. resoponsexml;
======================================
Format POST Request Parameters Using Functions
Function addparam (paramobj, paramname, paramvalue ){
If (paramobj. length> 0)
Paramobj + = "&";
Return paramobj + encodeuricomponent (paramname)
+ "=" + Encodeuricomponent (paramvalue );
}
========================================================== =====
Traversal in Javascript
For (pop in windowxxxx ){
.....
}