/ / -------------------------------------------------------------------------------------------- - Begin ----------------------------------------------- ---------- // 1: Create a DOM object Objdom
/ / -------------------------------------------------------------------------------------------- ------ // jscript / javascript: // var DOC = New ActiveXObject ("Microsoft.xmLDom") // VB Script: // DIM DOC // SET DOC = CreateObject ("Microsoft.xmLDom") //// VB: // DIM DOC As Object // Set Doc = CreateObject ("Microsoft.xmLDom") // or // DIM DOC AS DOMDocument // SET DOC = New DomDocument / / ----------- -------------------------------------------
VAR ObjDom = New ActiveXObject ("Microsoft.xmLDom") ObjDom.LoadXML ("
// add attributes to the presence or node var objNewAttr objNewAttr = objDom.createAttribute (strAttrName) objNewAttr.text = strAttrValue objDom.selectSingleNode (strNode) .Attributes.setNamedItem (objNewAttr) // 3: Use xmlHttp // Create Object var xmlHttp objHttp = new ActiveXObject ( "MICROSOFT.XMLHTTP") objHttp.open ( "POST", strAspPageName, false) // false is not representative of asynchronous processing objHttp.setRequestHeader ( "Content-Type", "application / x-www-form-urlencoded ") // Pass the DOM object to the specified page objhttp.send (objDom) // After accepting the DOM object ObjDom.Load (objhttp.responsestream) / / after the specified page processing, you can operate //// -------------------------------------------------- -END ---------------------------------------------------------------------------------------------- ------- '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' 4: Specifies the action of the page StrasppageName to create DOM object ObjBackDom in the background ASP page. Used to return to the front desk DIM OBACKDOM SET OBABACKDOM = CreateObject ("msxml2.domdocument") objBackDom.Load "
'' Creating a DOM object Objgetdom Used DOM object DOM object DOM object DIM objectDom set objgetdom = CreateObject ("msxml2.domdocument")
'' Set asynchronous processing to false '' asynchronous processing ---- false to cancel asynchronous processing TRUE to turn on the asynchronous process '' If the asynchronous process is turned off, wait until the document is completely loaded in order to give the control right to code '' When you open asynchronous processing, you should first judge mydom.readyState '' '' where: readyState = 0 indicate that the XML document is accessed: ReadyState = 1 indicates that the load: the Load method is executing '' readyState = 2 Turn into completion: The LOAD method has completed '' readyState = 3 represents the interaction phase: DOM can perform a read-only test, the data part parsing '' readyState = 4 is completed: data is fully resolved, you can read / write ObjgetDom.async = false ObjgetDom.Load Request '' is later to do is to define the value of the variable to get the node in ObjgetDom Dim Straction Straction = ObjgetDom.SelectSingeLnode ("// Action"). Text
'' Data interaction with the database DIM RS, conn
'Query to obtain data and generate objBackDom dim objNodeChild set ohjNodeChild = objBackDom.createElement (strNodeName)' 'is the value objBackDom.selectSingleNode strNodeName node name of the node to be added ohjNodeChild.text = strNodeValue' 'strNodeValue is to be added (strNodeParent ) .appendchild (ohjnodechild) '' StrnodeParent is the parent path to add child nodes
'' Return ObjBackDom to Client End ObjBackDom.Save Response Response.end '' '' '' '' '' '' '' '' '' '' '' '' '' '' ' '' '' '' '' 'End' '' '' '' '' '' '' '' '' '' '' '' '' ' '' '' '' '' '' '' '' '' '' '' ''