请教动态双组合功能过程中的一个问题:我按照实例调通了的,数据表中数据若为数字就没问题,一旦改为中文红色标注语句获取到的对象就为空
//xml文件
<?xml version="1.0" encoding="GBK"?>
<selectChoice>
<selectElement>
<formName>form1</formName>
<formElem>station</formElem>
</selectElement>
<entry>
<optionText>select</optionText>
<optionValue>-1</optionValue>
</entry>
<entry>
<optionText>TerritoryDescription</optionText>
<optionValue>TerritoryID</optionValue>
</entry>
</selectChoice>//调用的js函数
function FillDropDown(){
var xmlDoc = this.req.responseXML.documentElement; //数据为中文时,为对象为null var xSel = xmlDoc.
getElementsByTagName('selectElement')[0];
var strFName = xSel.
childNodes[0].firstChild.nodeValue;
var strEName = xSel.
childNodes[1].firstChild.nodeValue;
//alert("strFName="+strFName+";strEName="+strEName);
var objDDL = document.forms[strFName].
elements[strEName];
objDDL.options.length = 0; var xRows = xmlDoc.
getElementsByTagName('entry');
for(i=0;i<xRows.length;i++){
var theText = xRows[i].
childNodes[0].firstChild.nodeValue;
var theValue = xRows[i].
childNodes[1].firstChild.nodeValue;
var option = new Option(theText,
theValue);
objDDL.options.add(option,
objDDL.options.length);
}
}
//xml文件
<?xml version="1.0" encoding="GBK"?>
<selectChoice>
<selectElement>
<formName>form1</formName>
<formElem>station</formElem>
</selectElement>
<entry>
<optionText>select</optionText>
<optionValue>-1</optionValue>
</entry>
<entry>
<optionText>TerritoryDescription</optionText>
<optionValue>TerritoryID</optionValue>
</entry>
</selectChoice>//调用的js函数
function FillDropDown(){
var xmlDoc = this.req.responseXML.documentElement; //数据为中文时,为对象为null var xSel = xmlDoc.
getElementsByTagName('selectElement')[0];
var strFName = xSel.
childNodes[0].firstChild.nodeValue;
var strEName = xSel.
childNodes[1].firstChild.nodeValue;
//alert("strFName="+strFName+";strEName="+strEName);
var objDDL = document.forms[strFName].
elements[strEName];
objDDL.options.length = 0; var xRows = xmlDoc.
getElementsByTagName('entry');
for(i=0;i<xRows.length;i++){
var theText = xRows[i].
childNodes[0].firstChild.nodeValue;
var theValue = xRows[i].
childNodes[1].firstChild.nodeValue;
var option = new Option(theText,
theValue);
objDDL.options.add(option,
objDDL.options.length);
}
}
解决方案 »
- 求助,“手写签字”怎么做啊?
- 恢复MySQL数据库
- commons-fileupload-1.1 到upload.parseRequest(request)时结果有时怎么null !!!请教
- 读取数据库的问题
- window.open()不被拦截
- 第二次调用showModalDialog时走后台代码后再返回前台时异常问题
- 如何不刷新页面调用另一个网站的jsp页面?
- 请问各位高人在点击了一个超连接后如何打开一个新窗口?
- 谁有java mail的原码下载连接!!?
- jsp页面中超链接怎么引用导入的Ajax中的方法!!!
- 请问使用SSH时对于两个有主外键关系的表怎么配置啊
- 从oracle数据库中读出的日期 后面为什么会有 .0
response.setCharacterEncoding("gbk");
response.setContentType("text/xml");
response.setCharacterEncoding("GB2312");