当前位置:编程学习 > asp >>

ASP中生成静态页面技术

<!--#include file="conn.asp"-->
<%
dim str
function menu(id)
set rs=server.CreateObject("adodb.recordset")
sql="select * from menu where id1="&id&" order by url,id"
rs.open sql,conn,1,1
str=str+"<table border='0' cellspacing='0' cellpadding='0'>"+chr(13)
i=1
while not rs.eof
ChildCount=conn.execute("select count(*) from menu where id1="&rs("id"))(0)
if ChildCount=0 then
if i=rs.recordcount then
menutype="file1"
else
menutype="file"
end if
menuname="<a href='"&rs("url")&"' target='_blank'>"&rs("menuname")&"</a>"
onmouseup=""
else
if i=rs.recordcount then
menutype="menu3"
listtype="list1"
onmouseup=" onMouseUp=change1('a"&rs("id")&"','b"&rs("id")&"');"
else
menutype="menu1"
listtype="list"
onmouseup=" onMouseUp=change2('a"&rs("id")&"','b"&rs("id")&"');"
end if
menuname=rs("menuname")
end if
str=str+"<tr><td id='b"&rs("id")&"' class='"&menutype&"'"&onmouseup&">"&menuname&"</td></tr>"+chr(13)
if ChildCount>0 then
str=str+"<tr id='a"&rs("id")&"' style='display:none'><td class='"&listtype&"'>"+chr(13)
menu(rs("id"))
str=str+"</td></tr>"+chr(13)
end if
rs.movenext
i=i+1
wend
str=str+"</table>"+chr(13)
rs.close
set rs=nothing
end function
补充:asp教程,技巧与性能优化
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,