国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
ASP生成靜態(tài)HTML文件大薈萃【一】
ASP生成靜態(tài)HTML文件大薈萃【一】

錄入的內(nèi)容,自動生成html文件.

程序代碼<%
filename=year(now)&month(now)&day(now)&minute(now)&".htm" '根據(jù)當(dāng)前時間生成文件名
if request("body")<>"" then
set objfso = Server.CreateObject("Scripting.FileSystemObject") '創(chuàng)建一個fso實例
set htmout = objfso.CreateTextFile(server.mappath(""&filename&""))
htmout.write "<html><head><title>"
htmout.write request.form("title")
htmout.write "</title></head><body>新聞標(biāo)題:"
htmout.write request.form("title")
htmout.write "<br>內(nèi)容(body):"
htmout.write request.form("body")
htmout.write "</body></html>"
htmout.close
set htmout=nothing
set objfso=nothing
end if
%>
<form name="form1" method="post" action="">
<table width="300" border="0" align="center">
<tr>
<td align="right">標(biāo)題:</td>
<td colspan="2"><input name="title" size=18></td>
</tr>
<tr>
<td align="right">內(nèi)容:</td>
<td colspan="2"><textarea name="body"></textarea></td>
</tr>
<tr>
<td align="right"> </td>
<td><input type="submit" name="Submit" value="生成"></td>
<td><a href="<%=filename%>" target="_blank">查看輸出的文件</a></td>
</tr>
</table>
<br>
<br>
<br>
</form>

 

 

錄入的內(nèi)容,自動生成html文件.

程序代碼<%
filename=year(now)&month(now)&day(now)&minute(now)&".htm" '根據(jù)當(dāng)前時間生成文件名
if request("body")<>"" then
set objfso = Server.CreateObject("Scripting.FileSystemObject") '創(chuàng)建一個fso實例
set htmout = objfso.CreateTextFile(server.mappath(""&filename&""))
htmout.write "<html><head><title>"
htmout.write request.form("title")
htmout.write "</title></head><body>新聞標(biāo)題:"
htmout.write request.form("title")
htmout.write "<br>內(nèi)容(body):"
htmout.write request.form("body")
htmout.write "</body></html>"
htmout.close
set htmout=nothing
set objfso=nothing
end if
%>
<form name="form1" method="post" action="">
<table width="300" border="0" align="center">
<tr>
<td align="right">標(biāo)題:</td>
<td colspan="2"><input name="title" size=18></td>
</tr>
<tr>
<td align="right">內(nèi)容:</td>
<td colspan="2"><textarea name="body"></textarea></td>
</tr>功能:接收表單傳值生成臨時XML文件,結(jié)合XSL,生成靜態(tài)HTML文件。

<!--process.asp
用于生成臨時XML文件,并生成靜態(tài)HTML文件
-->

<!--#include file="conn.inc"-->
<%
author=request.form("n_author")
title=request.form("n_title")
content=request.form("n_content")
tempXml=replace( replace( replace (now,":",""), "-", ""), " ", "") & ".xml"
dim objdom
set objdom=server.createobject("Microsoft.XMLDOM")
dim objroot
set objroot=objdom.createElement("moonpiazza")
objdom.appendchild objroot

Set objPI = objDom.createProcessingInstruction("xml","version='1.0'")
objDom.insertBefore objPI, objDom.childNodes(0)

dim objbook
set objbook=objdom.createElement("book")
objroot.appendchild objbook

set objtit=objdom.createElement("書名")
objtit.text=title
objbook.appendchild objtit

set objaut=objdom.createElement("作者")
objaut.text=author
objbook.appendchild objaut

set objpri=objdom.createElement("定價")
objpri.text=content
objbook.appendchild objpri

'生成臨時XML放于TEMP文件夾下

objdom.save(server.mappath("temp/"&tempXml))

'//以下部分為生成htm部分
cHtmLFile = replace( replace( replace (now,":",""), "-", ""), " ", "") & ".htm"

cXMLFile =server.mappath("temp/"&tempXml)
cXSLFile = Server.MapPath("book.xsl")
cOutputFile = Server.MapPath("news/"&cHtmLFile)

Set oXML = Server.CreateObject("Microsoft.XMLDOM")
oXML.async = false
oXML.load(cXMLFile)

Set oXSL = Server.CreateObject("Microsoft.XMLDOM")
oXSL.async = false
oXSL.load(cXSLFile)

Set oOutput = Server.CreateObject("Microsoft.XMLDOM")
Call oXML.transformNodeToObject(oXSL, oOutput)

oOutput.save (cOutputFile)

Set oXML = Nothing
Set oXSL = Nothing
Set oOutput = Nothing

sql="INSERT INTO news(author,title,content,url) values('"&author&"','"&title&"','"&content&"','news/"&cHtmLFile&"')"

conn.execute(sql)

'生成HTM文件保存到NEWS文件夾下

Response.redirect("news/"&cHtmLFile)

%>

<!--list.asp

文件列表-->

<!--#include file="conn.inc"-->
<%response.contentType="text/html"%>
<html>
<body>
<%
response.write("<table>")
set rs=server.createobject("adodb.recordset")
rs.open "select * from news ",conn,1,1
do while not rs.eof
response.write("<tr><td><a href="&rs("url")&" target='_blank'>"&rs("title")&"</a></td></tr>")
rs.movenext
loop
response.write("</table>")
%>

 

 

<tr>
<td align="right"> </td>
<td><input type="submit" name="Submit" value="生成"></td>
<td><a href="<%=filename%>" target="_blank">查看輸出的文件</a></td>
</tr>
</table>
<br>
<br>
<br>
</form>

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Recordset對象操作數(shù)據(jù)庫語法_湘
寫了段VBA代碼,幫你爬取TA在QQ空間的說說數(shù)據(jù)
織夢(dedecms)仿站教程第十六講—首頁其它部分及站內(nèi)調(diào)查
ASP初級教程3
play framework學(xué)習(xí)筆記之play tags頁面模板
中國.Net論壇--『 其他站點的文檔轉(zhuǎn)載和推薦 』 瀏覽:[轉(zhuǎn)載]用ADO對Excel的數(shù)據(jù)查詢--中國最大的.Net社區(qū)
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服