asp

位置:IT落伍者 >> asp >> 浏览文章

asp无限级分类支持js收缩伸展


发布日期:2023年02月16日
 
asp无限级分类支持js收缩伸展

<! #include file="adoconnasp" >
<style>
dotted_class{
borderbottom:px dotted #;
}
dotted_class a{
textdecoration:none;
fontsize:px;
}
td{
fontsize:px;
}
</style>
<script language="javascript教程">
function $$(id)
{
return documentgetElementById(id);
}

function fd(idnum)
{
t=$$("d_"+id)src;
if(tindexOf("+gif")>)
{
t="block";
t="images/gif";
}
else
{
t="none";
t="images/+gif";
}
for(i=;i<=num;i++)
{
$$("c"+id+"_"+i)styledisplay=t;
$$("d_"+id)src=t;
}
}

</script>

<%
catstr=""
depath=
Call cat()
%>
<TABLE width="">
<TR>
<TD><%=catstr%></TD>
</TR>
</TABLE>
<%
function cat(parent_idtidstype)
set rs =servercreateobject("adodbrecordset")
sql="select cat_namecat_idparent_id from category where parent_id="&parent_id&" and u_id="&stype&" and is_show= order by cat_order asc"
set rs=connexecute(sql)
If rseof Then
Else
if(depath>) then
display="none"
else
display="block"
end if
dim j
j=
do while not rseof
cat_name = rs("cat_name")
cat_id = rs("cat_id")
parent_id=rs("parent_id")
******************下面是你要显示的******************
m=
sql="select count(cat_id) as t from category where parent_id="&cat_id&" and u_id="&stype&""
set rs=servercreateobject("adodbrecordset")
set rs=connexecute(sql)
if not rseof then
m=rs("t")
else
m=
end if
rsclose

if(depath<=) then
mgif="images/gif"
a="block"
else
if(m>) then
mgif="images/+gif"
else
mgif="images/gif"
end if
if(depath=) Then
a="block"
else
a="none"
end if
end If
If cat_id= or cat_id= Then
a="block"
mgif="images/+gif"
ElseIf cat_id> Then
a="none"
mgif="images/gif"
else
End if
catstr=catstr & "<tr id=""c"&parent_id&"_"&j&""" style=""display:"&a&"""><td width="""" align=""center"" valign=""middle"" class=""dotted_class"">&nbsp;</td><td class=""dotted_class leftcatcss教程"">"
for i= to depath
catstr=catstr&"&nbsp;"
Next
catstr=catstr&"<img src="""&mgif&""" width="""" height="""" id=""d_"&cat_id&""">&nbsp;"
if(m>) then
catstr=catstr&"<a href=""javascript:void();"" onclick=""fd("&cat_id&""&m&")"">" &vbnewline
else
catstr=catstr&"<a href=""productsasp?id="&cat_id&""">"&vbnewline
end if
If depath= Then
cat_name="<span style=""fontsize:px; fontweight:bold;"">"&cat_name&"</span>"
End If
catstr=catstr&cat_name&"</a></td></tr>"&vbnewline
m=

sql="select cat_namecat_id from category where parent_id="&parent_id&" and u_id="&stype&" order by cat_order asc"
set rs=servercreateobject("adodbrecordset")
set rs=connexecute(sql)
if not rseof then
depath=depath+
call cat(cat_idtidstype)
end if
rsclose
set rs=nothing
depath=depath
******************上面是你要显示的******************
j=j+
rsmovenext
loop


End If
rsclose
set rs=nothing
end Function
%>

数据库教程连接文件adoconnasp

<%@LANGUAGE="VBSCRIPT" CODEPAGE=""%>
<%
responseCharset="utf"
responsecodepage=""

DB="dbmdb"

path=ServerMapPath(DB)
set conn=servercreateobject("adodbConnection")
connstr="provider=MicrosoftJetOLEDB;Data Source="&path
connOpen connstr
Set rs=serverCreateObject("adodbrecordset")
%>

上一篇:asp能用数据库操作类

下一篇:asp用户退出登陆代码