求助!全局数组取不到值?
贴出代码如下:var supplierNames=new Array();
function initForm() {
var conn = new ActiveXObject("ADODB.Connection");
conn.open("DRIVER=MySQL ODBC 5.2 Unicode Driver;UID=root;PWD=1234;PORT=3306;DATABASE=test;SERVER=localhost");
var rs = new ActiveXObject("ADODB.RecordSet");
var s1 = "select suppliersID,name from suppliers";
rs.open(s1, conn);
if(!rs.eof){
while (!rs.eof) {
supplierNames[rs(0)]=rs(1);
rs.moveNext();
}
}else{
alert("没有查到供应商。");
}
if(!rs) {}else{rs.close();rs=null;}
if(!conn){}else{conn.close();conn=null;}
}
function shenhe() {
for(x in supplierNames) alert(supplierNames[x]);
}
为什么shenhe() 输出的是【object】?怎样改,才能是赋值时的字符串?
[ 本帖最后由 传奇2015 于 2014-8-27 16:06 编辑 ]