function ACClient( queryurl, width, objInput, objLable )
{
this.xmldom = getXmlhttp();
this.queryurl = queryurl;
this.prolist = new Array();
this.divwidth = width;
this.objInput = objInput;
this.getEligible = function(ac) {
var eligible = new Array();
if (ac.inputText.length < 1) {
document.getElementById(objInput.name).value = "";
document.getElementById(objLable.name).value = "";
return eligible;
}
var strURL = this.queryurl + escape(ac.inputText) + "&rand=" + Math.random();
this.xmldom.open("GET", strURL, false);
try {
this.xmldom.send();
}
catch (e) {
return;
}
this.prolist = this.xmldom.responseXML.documentElement.selectNodes("/duxion/object");
if (0 == this.prolist.length) {
return eligible;
}
for (var i = 0; i < this.prolist.length; i++) {
if (i > 15)
break;
var node = this.prolist.item(i);
eligible[eligible.length] = node.getAttribute("fullcontent");
}
ac.div.style.width = this.divwidth;
return eligible;
};
this.useSuggestion = function( sel )
{
if( sel>=0 )
{
var node = this.prolist.item(sel);
if(typeof(node.getAttribute( "value" )) != "undefined")
document.getElementById(objInput.name).value = node.getAttribute( "value" );
else
document.getElementById(objInput.name).value = "";
if(typeof(node.getAttribute( "content" )) != "undefined")
document.getElementById(objLable.name).value = node.getAttribute( "content" );
else
document.getElementById(objLable.name).value = "";
if (this.objInput.name == "hidfreq_code") {
document.getElementById("txtfreq_name").value = node.getAttribute("Name");
document.getElementById("hidfreq_code").value = node.getAttribute("Code");
}
}
};
return this;
}
4。 另外的.js以及.css文件见附件