请帮忙分析一段xmldom的程序!
以下两段程序看得不是太懂,请大家帮忙分析下其具体含义和作用:
rsxml.js
//============================================================================================================================
// The constructor function : create a httprequest object for maintain the database file through ADO
// Arguments :
// dsn : A string that specifies database connection. Required.
// sql : A string that specifies SQL command. Required.
// act : A character that identifies which action such as R-read, U-update, D-delete, A-add, S-execute. Required.
// data : An object that stores fieldname and fieldvalue when act is R/U/A.
// Returns :
// A string that specifies return status. if null menas normal otherwise stores error message.
//============================================================================================================================
function rsxml(dsn,sql,act,data,asp){
this.dsn = dsn;
this.sql = sql;
this.act = act;
if(data) this.data = data;
if(asp) this.asp = asp;
else this.asp= '/repsite/mysys/rsxml.asp ';
}
function rsxml_send(){
var s = ' <rsxml> </rsxml> ';
var xmldom = new ActiveXObject( "Microsoft.XMLDOM ");
xmldom.async = "false ";
xmldom.loadXML(s);
var n = xmldom.createElement( "dsn ");
n.text = this.dsn;
xmldom.documentElement.appendChild(n);
var n = xmldom.createElement( "sql ");
n.text = this.sql;
xmldom.documentElement.appendChild(n);
var n = xmldom.createElement( "act ");
n.text = this.act;
xmldom.documentElement.appendChild(n);
if(this.act== 'U '||this.act== 'A '){
var n = xmldom.createElement( "data ");
xmldom.documentElement.appendChild(n);
var xmldata = xmldom.getElementsByTagName( "data ").item(0);
for(var p in this.data){
var n = xmldom.createElement(p);
n.text = this.data[p];
xmldata.appendChild(n);
}
}
if(!xmldom.parseError.errorCode){
var x = new ActiveXObject( "Microsoft.XMLHTTP ");
x.open( "GET ",this.asp,false);
x.send(xmldom);
var y = x.responseXML;
if(x.status==200){
if(this.act== 'M '){
var z = y.documentElement.childNodes.item(0).childNodes
for(i=0;i <z.length;i++){
var xrow = new Object;
var r = z.item(i).childNodes
for(j=0;j <r.length;j++){