ASP生成静态页(4)-将以下文件保存为:adminnews.asp !--#include file=conn.asp --

海南网站建设,网页设计
记忆工作中的点滴
首页>> Asp技术 >>ASP生成静态页(4)

将以下文件保存为:adminnews.asp

<!--#include file="conn.asp" -->
<!--#include file="lib.asp" -->
<%
Set rs = Server.CreateObject ("ADODB.Recordset")
sql = "Select * from news order by id desc"
rs.Open sql,conn,1,1
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>列表</title>
<style type="text/css">
<!--
body {
 font-family: Arial, Helvetica, sans-serif;
 font-size: 12px;
 font-weight: normal;
 color: #000000;
 margin:0px auto;
 line-height:25px;
}
.table {
    margin-top:10px;
 border:1px #e6e6e6 solid;
}
.title {
    line-height:30px;
 text-align:right;
 font-size:16px;
 background:#FAFAFA;
}
-->
</style>
</head>

<body>
<%
if rs.EOF and rs.BOF then
response.write ("<div style=""padding:10px;text-align:center;"">对不起!暂无新闻可显示</div>")
else
Do Until rs.EOF
%>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
  <tr>
    <td width="500">·<a href=<%=rs("filepath")%> target="_blank"><%=rs("title")%></a></td>
    <td width="150" align="center"><%=rs("time")%></td>
    <td align="center"><a href=edit.asp?id=<%=rs("id")%>>修改</a> <a href=del.asp?id=<%=rs("id")%>>删除</a></td>
  </tr>
</table>
<% rs.MoveNext
Loop
end if
%>
<%
rs.close
Set rs = Nothing
conn.close
set conn=Nothing
%>

</body>
</html>
 

将以下文件保存为:lib.asp

<%
'生成文件名的函数
function makefilename(fname)
fname = fname
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
makefilename=fname & ".html"
end function

'保持数据格式不变的函数
function HTMLEncode(fString)
fString = replace(fString, ">", "&gt;")
fString = replace(fString, "<", "&lt;")
fString = Replace(fString, CHR(32), "&nbsp;")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "<br>")
fString = Replace(fString, CHR(10), "<br>")
HTMLEncode = fString
end function
%>
 


×

感谢您的支持,我们会一直保持!

扫码支持
请土豪扫码随意打赏

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

打赏作者
版权所有,转载注意明处:不懂戀愛魚兒 » ASP生成静态页(4)
标签: asp 静态

发表评论

路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交

网友评论(0)