二级联动 无法使用!大家帮我看看啊~
<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.util.*,java.sql.*,com.yourcompany.struts.database.NewsBean,com.yourcompany.struts.form.* " %>
<%
NewsBean Conn=new NewsBean();
ResultSet rs;
%>
<html>
<head>
<title> 后台产品添加 </title>
<script language = "JavaScript ">
var onecount;
onecount=0;
subcat = new Array();
<%
int count = 0;
rs = Conn.executeQuery( "select * from category order by categoryno ");//读取数据
while(rs.next())
{
String sname=new String(rs.getString( "categoryname ").getBytes( "GBK "), "ISO8859_1 ");//转换字符类型
%>
subcat[ <%=count%> ] = new Array( " <%=sname%> ", " <%=rs.getInt( "belong ")%> ", " <%=rs.getInt( "categoryno ")%> ");//产生数组
<%
count = count + 1;
}
%>
onecount= <%=count%> ;
function changelocation(id)
{
document.form1.smallsortselect.length = 0;
var id=id;
var i;
document.form1.smallsortselect.options[0] = new Option( ' ' ' '选择二级分类 ' ' ' ', ' ' ' ' ' ' ' ');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == id)
{
document.form1.smallsortselect.options[document.form1.smallsortselect.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
</head>
<body bgcolor= "#FFFFFF ">
<form name= "form1 " method= "post " action= " ">
<table width= "500 " border= "0 " cellspacing= "0 " cellpadding= "0 " align= "center ">
<tr>
<td width= "180 " height= "20 " align= "right "> 选择一级分类: </td>
<td width= "320 ">
<select name= "bigsortselect " onChange= "cha