Easp 无限分类

<%
Function CheckNum(Byval Num)
  If Not Isnumeric(Num) Then
    CheckNum=0
    Exit Function
  End If
    CheckNum=Cint(Num)
End Function

Sub GetClassOption(Byval C_ID,Byval CoinStr)
  C_ID=CheckNum(C_ID)
  If C_ID<>0 Then
    Set Rs_CID=Easp.db.Exec("Select * From class Where parentid="&C_ID)
    Do While Not Rs_CID.Eof
      Response.Write("<option value="""&Rs_CID("ID")&"""")
      If ClassID=int(Rs_CID("ID")) Then Response.Write("selected=""selected""")
      Response.Write(">"&CoinStr&""&Rs_CID("title")&"</option>"&vbcrlf)
      Call GetClassOption(Rs_CID("ID"),"    "&CoinStr)
    Rs_CID.Movenext
    Loop
    Rs_CID.Close
    Set Rs_CID=Nothing
  End If
End Sub
%>
<select name="ClassID" id="ClassID">
    <option value="0">请选择分类</option>
    <%
		Set Rs=Easp.db.Exec("select * From class Where parentid=0 Order by ID")
		Do While Not Rs.Eof
			Response.Write("<option value="""&Rs("ID")&"""")
			Response.Write(">|-"&Rs("title")&"</option>"&vbcrlf)
			Call GetClassOption(Rs("ID"),"|---")
		Rs.Movenext
		Loop
		Rs.Close
		Set Rs=Nothing
    %>
</select>
posted @ 2010-11-17 13:46  aksoft  阅读(264)  评论(0编辑  收藏  举报