日期:2014-05-17  浏览次数:21374 次

求ASP生成html或者shtml的简洁代码
求ASP生成html或者shtml的简洁代码,这样的程序太多了,不知道用哪个好...有没有简单点的
最好给个实例.先谢谢了!

------解决方案--------------------
VBScript code
gid=request("bcid")
  set rs=server.createobject("adodb.recordset")
      sql="select * from newsbigclass where id="&gid
            rs.open sql,conn,1,1
            if not rs.eof then
            bcname=rs("bcname")
            bcurl=rs("bcurl")
            bcmenu=rs("bcmenu")
            end if
            rs.close
            set rs=nothing
    set rs=server.createobject("adodb.recordset")        
  sql="select * from news where bcid="+cstr(gid)+" order by id desc"
            rs.open sql,conn,1,1
            if rs.eof then
            new1="<br><br><div align=center>暂时没有该类信息</div><br><br>"
            set rs1=server.createobject("adodb.recordset")
        sql1="select top 1 * from newsbmob order by id desc"
        rs1.open sql1,conn,1,1
        mb1=rs1("moban")
        rs1.close
        mb1=replace(mb1,"[body]",new1)'大类内容
    
        title=bcname&"--本站信息"'网站标题
        mb1=replace(mb1,"[cnleft]",title)'网站标题
    
    title1=bcname
    mb1=replace(mb1,"[title1]",title1)'大类名称
    
    
    filename2="../html/newsclass/bclass/"&bcmenu&"/"&bcurl&".html"
    
    set fso=server.createobject("scripting.filesystemobject")
    set ffile=fso.createtextfile(server.mappath(""&filename2&""))
    ffile.write""&mb1&""
    ffile.close
    set ffile=nothing
    set fso=nothing
    set rs1=nothing

------解决方案--------------------
VBScript code
<%
bcid=request.Form("bcid")
scid=request.Form("scid")



if bcid<>"" and scid="" then
sql="select * from NEWS where bcid="&bcid'固定某大类ID
elseif bcid<>"" and scid<>"" then
sql="select * from NEWS where bcid="&bcid& " and scid="&scid'固定某小类ID
else
sql="select * from NEWS"'生成所有的
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if not rs.eof then
i=0
do while not rs.eof
title=rs("title")
titlecolor=rs("titlecolor")
content=rs("neirong")
laiyuan=rs("laiyuan")
ndate=rs("ndate")
bcname=rs("bcname")
scname=rs("scname")
pic=rs("photo")
author=rs("author")
edituser=rs("edituser")
bcid=rs("bcid")
scid=rs("scid")
newsurl=rs("newsurl")
id=rs("id")

set js = server.CreateObject("ADODB.RecordSet")
sql="select * from newsbigclass where id="&bcid'大类表
set js = conn.Execute (Sql) 
if not js.eof then
    bcname=js("bcname")'大类名称 
    bcurl=js("bcurl")  
goaler ="<a href="&bcurl&">"&bcname&"</a>"'大类连接
end if
js.close
set js = nothing

set js = server.CreateObject("ADODB.RecordSet")
sql="select * from newssmallclass where id="&scid'大类表
set js = conn.Execute (Sql) 
if not js.eof then
    scname=js("scname")'大类名称 
    scurl=js("scurl")  
goaler1 ="<a href="&scurl&">"&scname&"</a>"'大类连接
end if
js.close
set js = nothing
mContent = content
    mContent = Replace(mContent,"<script","<sscript") 
    mContent = Replace(mContent,"/script>","/scripts>")
    mContent = Replace(mContent,"/script >","/scripts>")
sql1="select * from newsmob where id=1"'模板表
set rs1