ASP中生成静态页面技术

演示:http://asp2004.net/temp/treemenu/menu.asp
源代码下载:http://asp2004.net/temp/treemenu.rar

< ! -- #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

menu(
0 )

Set fso = server. CreateObject ( " scripting.filesystemobject " )
Set f1 = fso.OpenTextFile(server.MapPath( " demo.htm " ), 2 , true )
f1.Write(
" <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'> " )
f1.Write(
" <html> " )
f1.Write(
" <head> " )
f1.Write(
" <meta http-equiv='Content-Type' content='text/html; charset=gb2312'> " )
f1.Write(
" <title>哈哈~~~!这回速度超快了吧?</title> " )
f1.Write(
" <meta name='keywords' content='asp2004,树,菜单,无限级'> " )
f1.Write(
" <meta name='author' content='小灰,quxiaohui_0@163.com'> " )
f1.Write(
" <link href='style.css' rel='stylesheet' type='text/css'> " )
f1.Write(
" <script language='javascript' src='function.js'></script> " )
f1.Write(
" </head> " )
f1.Write(
" <body> " )
f1.Write(
" <a href='http://asp2004.net' target='_blank'>http://asp2004.net</a>提供最新下载《<a href='menu.asp'>管理</a>》<br> " )

f1.Write(Str)

f1.Write(
" </body> " )
f1.Write(
" </html> " )
f1.Close
Set fso = Nothing

response.Redirect(
" demo.htm " )
%
>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值