Sub ShowSmallClass_Tree()
%>
<SCRIPT language=javascript>
function opencat(cat,img){
if(cat.style.display=="none"){
cat.style.display="block";
img.src="img/class2.gif";
} else {
cat.style.display="none"; 
img.src="img/class1.gif";
}
}
</Script>
<TABLE cellSpacing=0 cellPadding=0 width="99%" border=0>
<%
dim i
set rsbig = server.CreateObject ("adodb.recordset")
sql="select * from BigClass"
rsbig.open sql,conn,1,1
if rsbig.eof and rsbig.bof then
Response.Write "栏目正在建设中……"
else
i=1
do while not rsbig.eof
%>
<TR>
<TD language=javascript onmouseup="opencat(cat10<%=i%>000,&#13;&#10; img10<%=i%>000);" id=item$pval[catID]) style="CURSOR: hand" width=34 height=24 align=center><IMG id=img10<%=i%>000 src="img/class1.gif" width=20 height=20></TD>
<TD width="662"><a href='Product.asp?BigClassName=<%=rsbig("BigClassName")%>'><%=rsbig("BigClassName")%></a></TD>
</TR>
<TR>
<TD id=cat10<%=i%>000 <%if rsbig("BigClassName")=BigClassName then 
     response.write "style='DISPLAY'"   
    else  
     response.write "style='DISPLAY: none'"
    end if%> colspan="2">
<%
dim rsSmall,sqls,j
set rsSmall = server.CreateObject ("adodb.recordset")
sqls="select * from SmallClass where BigClassName='" & rsbig("BigClassName") & "' order by SmallClassID"
rsSmall.open sqls,conn,1,1
if rsSmall.eof and rsSmall.bof then
Response.Write "没有小类"
else
j=1
do while not rsSmall.eof
%>
&nbsp;<IMG height=20 src="img/class3.gif" width=26 align=absMiddle border=0><a href="Product.asp?BigClassName=<%=rsSmall("BigClassName")%>&Smallclassname=<%=rsSmall("SmallClassName")%>"><%=rsSmall("SmallClassName")%></a><BR>
<%
rsSmall.movenext
j=j+1
loop
end if
rsSmall.close
set rsSmall=nothing
%>
</TD>
</TR>
<%
rsbig.movenext
i=i+1
loop
rsbig.close
    set rsbig=nothing
end if
%>
</TABLE>
<%
end Sub 定义了这样一个类,页面运行的时候 点击<TD language=javascript onmouseup="opencat(cat10<%=i%>000,&#13;&#10; img10<%=i%>000);" id=item$pval[catID]) style="CURSOR: hand" width=34 height=24 align=center><IMG id=img10<%=i%>000 src="img/class1.gif" width=20 height=20></TD>
触发后就提示说:style.display为空或者不是对象
是一个树形菜单,奇怪的是就点第一个+号(class1.gif)时候会提示,而后面就正常,也就是当i=1的时候有错误。不知道什么原因帮忙看下