asp如何把动态的数组名传递给javascrip自定义函数并作为它的参数
var China = new Array("Beijing" , "北京",
"Anhui" , "安徽",
"Zhejiang" , "浙江") ;
var Anhui = new Array(
"hefei" , "合肥市",
"suzhou" , "宿州市",
"Anhui others" , "其它地区") ;
function array_num(country,state)
{
var i;
for (i = 0; i < country.length; i++)
{
if (state=country[i])
state2=country[i+1];
break ;
}
return state2;
}
function array_num2(state,city){
var j;
for (j=0;j<state.length;j++)
{
if (city=state[j])
city2=state[j+1]
break;
}
return city2;
}
//以上为Javascript里语句;
//下面为在asp里的调用;
<%=array_num(rs("country"),rs("state"))%>//意途为:当rs("country")为china,rs("state")为Anhui时,返回"安徽"值;
<%=array_num2(rs("country"),rs("state"))%>//意途为:当rs("state")为Anhui,rs("city")为hefei时,返回"合肥"值;
但报错:类型不正确!