熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp無限級分類支持js收縮伸展

2022-06-13   來源: .NET編程 

  <! #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")
%>


From:http://tw.wingwit.com/Article/program/net/201311/14405.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.