var doc1 = new ActiveXObject("Microsoft.XMLDOM");
var doc2 = new ActiveXObject("Microsoft.XMLDOM");
doc1.async = false;
doc2.async = false;
function selectChange(objList,cTable,cField1,cField2,cKeyField,KeyValue,cOrderField,defaValue,emptyLine,cDsn)
	{
	//objList：目标对象;
	//cTable：需要提取数据的表;
	//cField1：其值为option's value的字段;
	//cField2：其值为option's label的字段;
	//ckeyField：关键字段;
	//KeyValue：关键字值，如果是字符串值要加上“'”;
	//cOrderField：排序的字段;
	//defaValue：默认值;
	//emptyLine：第一行是否为空;
	//cDsn：ConnectionString;
	objList = eval(objList);
	while(objList.hasChildNodes()) objList.removeChild(objList.firstChild);
	if (emptyLine){
		opt=document.createElement("OPTION");
		opt.value="";
		txt=document.createTextNode("    ");
		opt.appendChild(txt);
		objList.appendChild(opt);
	}
	if (KeyValue != 0 ){
		if (KeyValue==0) KeyValue=0;		//这么写是因为ID有可能是NULL，大概是微软的BUG
		//cRootUrl在menu.js中定义并赋值
		var cLoad1 = cRootUrl + "js/xmlsele1.asp?table=" + cTable + "&field=" + cField1 + "&kField=" + cKeyField + "&kValue=" + KeyValue + "&oField=" + cOrderField + "&dsn=" + cDsn;
		var cLoad2 = cRootUrl + "js/xmlsele1.asp?table=" + cTable + "&field=" + cField2 + "&kField=" + cKeyField + "&kValue=" + KeyValue + "&oField=" + cOrderField + "&dsn=" + cDsn;
//document.write(cLoad1)
//window.open(cLoad1);
		doc1.load(cLoad1);
		xmldoc1=doc1.documentElement;

		if (cField1==cField2 || cField2 =="" || cField2==null){
			xmldoc2=xmldoc1;
		}else {
			doc2.load(cLoad2);
			xmldoc2=doc2.documentElement;
		}
		
		currentCount=xmldoc1.childNodes.length;

		for (var i=0;i<currentCount;i++){
			elval=xmldoc1.childNodes[i].text
			eltxt=xmldoc2.childNodes[i].text

			opt=document.createElement("OPTION");
			opt.value=elval;
			if (elval==defaValue)opt.selected=1;
			txt=document.createTextNode(eltxt);
			opt.appendChild(txt);
			objList.appendChild(opt);
		}
	}
}

