请求大侠帮我分析一下:
<script language="javascript">
function check()
{
if( window.myform.reason.value==""){alert("please select reason");return false}
if( window.myform.ChannelId3.value==""){alert("please select item");return false}
}
var g_selProvince;
var g_selCity;
var g_selCounty;
file://一级目录
var Provinces=new Array();
<%
set rs1=server.CreateObject("adodb.recordset")
rs1.open "select * from smallclass",conn,3,3
i=0
do while not rs1.eof
%>
Provinces[<%=i%>]=new Array("<%=rs1("smallclassid")%>","<%=trim(rs1("smallclassname"))%>");
<%rs1.movenext
i=i+1
loop%>
file://Array("与下级索引","显示的值")
file://二级目录
var Citys=new Array();
<%
set rs2=server.CreateObject("adodb.recordset")
rs2.open "select * from product",conn,3,3
i=0
do while not rs2.eof
%>
Citys[<%=i%>]=new Array("<%=rs2("smallclassid")%>","<%=rs2("productid")%>","<%=trim(rs2("productname"))%>");
<%rs2.movenext
i=i+1
loop%>
file://Array("本级索引","与下级索引","显示的值")
file://三级目录
var Countys=new Array();
<%
set rs3=server.CreateObject("adodb.recordset")
rs3.open "select * from item",conn,3,3
i=0
do while not rs3.eof
%>
Countys[<%=i%>]=new Array("<%=rs3("productid")%>","<%=rs3("itemid")%>","<%=trim(rs3("ino"))%>/<%=trim(rs3("itemname"))%>"),
<%rs3.movenext
i=i+1
loop%>
file://Array("本级索引","与下级索引","显示的值")
function FillProvinces(selProvince)
{
selProvince.options[0]=new Option("select small class","");
for(i=0;i<Provinces.length;i++)
{
selProvince.options[i+1]=new Option(Provinces[i][1],Provinces[i][0]);
selProvince.options[0].selected=true;
}
selProvince.length=i+1;
}
function FillCitys(selCity,ProvinceCode)
{
selCity.options[0]=new Option("select product","");
count=1;
for(i=0;i<Citys.length;i++)
{
if(Citys[i][0].toString()==ProvinceCode)
{
selCity.options[count]=new Option(Citys[i][2],Citys[i][1]);
selCity.options[0].selected = true;
count=count+1;
}
}
selCity.length=count;
}
function FillCountys(selCounty,CityCode)
{
selCounty.options[0]=new Option("select item","");
count=1;
for(i=0;i<Countys.length;i++)
{
if(Countys[i][0]==CityCode)
{
selCounty.options[count]=new Option(Countys[i][2],Countys[i][1]);
selCounty.options[0].selected = true;
count=count+1;
}
}
selCounty.length=count;
}
function City_onchange()
{
FillCountys(g_selCounty,g_selCity.value);
}
function Province_onchange()
{
FillCitys(g_selCity,g_selProvince.value);
City_onchange();
}
function InitCitySelect(selProvince,selCity,selCounty)
{
g_selProvince=selProvince;
g_selCity=selCity;
g_selCounty=selCounty;
selProvince.onchange=Province_onchange;
selCity.onchange=City_onchange;
FillProvinces(selProvince);
Province_onchange();
}
</script>