读书人

读取二级下拉框解决思路

发布时间: 2012-01-02 22:40:04 作者: rapoo

读取二级下拉框
<script language= "JavaScript ">
var onecount; //定义onecount对像
onecount=0; //初始值为0
subcat=new Array(); //SUBCAT对像是一个新的数组
<%
int count=0;
ArrayList pro_lifts=main_Produmain.getSproduList();
int my_pro_lift_a=pro_lifts.size();
for(int i=0;i <my_pro_lift_a;i++)
{
Map my_rs2=(Map)pro_lifts.get(i);
%>
subcat[ <%out.print(count);%> ]=new Array( ' <%out.print(my_rs2.get( "s_c_name "));%> ', ' <%out.print(my_rs2.get( "b_c_id "));%> ', ' <%out.print(my_rs2.get( "s_c_id "));%> ');

<%
count=count+1;
}
%>
onecount= <%out.print(count);%> ;

function changelocation(S_ID)
{
document.form1.smalllocation.length=0;
var S_ID=S_ID;
var i;
document.form1.smalllocation.options[0]=new Option( '二类型 ', ' ');
for (i=0;i <onecount;i++)
{
if (subcat[i][1]==S_ID)
{
document.form1.smalllocation.options[document.form1.smalllocation.length]=new Option(subcat[i][0],subcat[i][2]);
}
}
}

</script>

<select name= "smalllocation " class= "kk " onChange= "changelocation2(document.form1.smalllocation.options[document.form1.smalllocation.selectedIndex].value) ">


<option selected value= " "> 二类型 </option>



</select>

[解决办法]
<%out.print(count);%> 把这样的都换成 <%=count%>
另外你这个是报什么错误了?

读书人网 >Java Web开发

热点推荐