<body bgcolor="#fffdf4" text="#000000" leftmargin="0" topmargin="0" onload = Changeproduct(document.all.product)>
<%
Dim Arr_productname
sub CloseRs(rs)
Rs.close
set Rs = nothing
end sub
Sql_All = "select Id,Name from product"
set Rs_All = Server.CreateObject ("adodb.recordset")
Rs_All.Open Sql_All,conn,3,1
Response.Write "<Select name = product id = product onchange = Changeproduct(this)>"
do while not Rs_All.EOF
%><option value = <%=Rs_All("Id")%>>
<%=Rs_All("Name")%>
<%
Rs_All.MoveNext
loop
Response.Write "</Select>"
CloseRs(Rs_All)
Sql_productname= "select Id,CId,Name from productname order by Id"
set Rs_productname = server.CreateObject ("adodb.recordset")
Rs_productname.Open Sql_productname,conn,3,1
count = Rs_productname.RecordCount
redim Arr_productname(count)
i = 0
do while not Rs_productname.EOF
New_Str = ""
theId = Rs_productname("Id")
theCId = Rs_productname("CId")
theName = Rs_productname("Name")
New_Str = theCId&","&theId&","&theName
Arr_productname(i) = New_Str
i = i +1
Rs_productname.MoveNext
loop
CloseRs(Rs_productname)
Conn.Close
set Conn = Nothing
Response.Write "<script language = javascript>"
Response.Write " var All_productname = new Array("&count&");"
for i = lbound(Arr_productname) to ubound(Arr_productname)-1
Response.Write "All_productname["&i&"] = '"&Arr_productname(i)&"';"
next
Response.Write "</script>"
%>
<script language="javascript">
function Changeproduct(id)
{
theproductId = id.options[id.selectedIndex].value;
for (j = document.all.productname.length;j>=0;j--) document.all.productname.remove(j);
for (i = 0 ;i<<%=count%>;i++)
{
theproductname = All_productname[i].split(",");
if (theproductId == theproductname[0])
{
document.all.productname.options.add(new Option(theproductname[2])); }
}
<script language="javascript">
function changelocation(locationid)
{
document.form1.smallclassid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form1.smallclassid.options[document.form1.smallclassid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}