50,530
社区成员
发帖
与我相关
我的任务
分享
function HTMLEncode( text )
{
if ( typeof( text ) != "string" )
text = text.toString() ;
text = text.replace(/&/g, "&").replace(/"/g, """);
return text ;
}
function initSelect(obj,b,c,d,xml){
var xmlStr = xml.xmlDoc.responseText;
var toCharXmlStr = HTMLEncode(xmlStr);
var options = xml.doXPath("//option");
var selObj = document.getElementById(obj[0]);
for (var i=0; i<options.length; i++) {
var text = options[i].firstChild?options[i].firstChild.nodeValue:"";
var value = options[i].getAttribute("value");
selObj.options[i] = new Option(text,value);
if(options[i].getAttribute("selected")=="1"){
selObj.options[i].selected = true;
}
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<option value="1">苹果&梨子</option>