如何用ASP輸出HTML文件?
<!--#include file="top.inc"-->
<%
u_title=request.form("u_title")<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
' 檢查標(biāo)題是否被輸入.
if u_title = "" then
%>
<form method="POST" action="<%= request.servervariables("script_name") %>">
<!--當(dāng)沒有標(biāo)題輸入時(shí)顯示輸入框-->
<p>文件標(biāo)題<br>
<input type="text" name="u_title" size="35"></p>
<p>Font Size<br>
<select size="1" name="u_text_size">
<option selected value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select></p>
<p>第1段<br>
<textarea rows="2" name="u_paragraph1" cols="35"></textarea></p>
<p>第2段<br>
<textarea rows="2" name="u_paragraph2" cols="35"></textarea><input type="submit" value="提交" ></p>
</form>
<%
end if
%>
<%
if u_title <> "" then
u_title=request.form("u_title")
u_paragraph1=request.form("u_paragraph1")
u_paragraph2=request.form("u_paragraph2")
u_text_color=request.form("u_text_color")
u_text_size=request.form("u_text_size")
g_filename=replace(u_title," ","_")
' 如果有一個(gè)用戶輸入了標(biāo)題,則獲取所有的用戶輸入的內(nèi)容.
set fso = createobject("scripting.filesystemobject")
Set act = fso.CreateTextFile(server.mappath("write2htm/"&g_filename & "-"& month(date())& day(date())& year(date()) &".htm"), true)
' 創(chuàng)建create the text (html) file文件到服務(wù)器,并添加mmddyyyy 格式年月日.
' 寫所有用戶輸入的text (html) 文件, .htm 擴(kuò)展名文件可以很容易地轉(zhuǎn)換成你網(wǎng)站最需要的.asp 或 .inc文件.
act.WriteLine "<html>"
act.WriteLine chr(13)
act.WriteLine "<title>"& u_title &"</title>"
act.WriteLine chr(13)
act.WriteLine "<body bgcolor='#FFFFFF'>"
act.WriteLine chr(13)
act.WriteLine "<p align='center'><font face='arial' size='"& u_text_size &"'>"
act.WriteLine chr(13)
act.WriteLine u_title &"</p>"
act.WriteLine chr(13)
act.WriteLine "<p align='left'><font face='arial' size='"&u_text_size&"'>"
act.WriteLine chr(13)
act.WriteLine u_paragraph1 &"</p>"
act.WriteLine chr(13)
act.WriteLine "<p align='left'><font face='arial' size='"& u_text_size &"'>"
act.WriteLine chr(13)
act.WriteLine u_paragraph2 &"</p>"
act.WriteLine chr(13)
act.WriteLine "<p> </p><p> </p><p> </p>"
act.WriteLine "<p align='center'><font face='arial' size='"& u_text_size &"'>"
act.WriteLine "此文件被創(chuàng)建!"
act.WriteLine now() &"</p>"
act.Close
' 關(guān)閉文件.
%>
您的頁面已成功創(chuàng)建!請點(diǎn)擊查看.
<a href="write2htm/<%= g_filename &"-"& month(date())& day(date())& year(date()) %>.htm"
target="_blank">查看</a>
<br>
<br>
<% response.write "<html>"
response.write chr(13)
response.write "<title>"& u_title &"</title>"
response.write chr(13)
response.write "<body bgcolor='#FFFFFF'>"
response.write chr(13)
response.write "<p align='center'><font face='arial' size='"& u_text_size &"'>"
response.write chr(13)
response.write u_title &"</p>"
response.write chr(13)
response.write "<p align='left'><font face='arial' size='"&u_text_size&"'>"
response.write chr(13)
response.write u_paragraph1 &"</p>"
response.write chr(13)
response.write "<p align='left'><font face='arial' size='"& u_text_size &"'>"
response.write chr(13)
response.write u_paragraph2 &"</p>"
response.write chr(13)
response.write "<p> </p><p> </p><p> </p>"
response.write "<p align='center'><font face='arial' size='"& u_text_size &"'>"
response.write "此文件被創(chuàng)建!"
response.write now() &"</p>"
end if
%>
<!--#include file="bottom.inc"-->
上一篇:如何顯示隨機(jī)信息?
欄 目:編程問答
下一篇:如何把URL和郵件地址轉(zhuǎn)換為超級鏈接?
本文標(biāo)題:如何用ASP輸出HTML文件?
本文地址:http://mengdiqiu.com.cn/a1/bianchengwenda/12054.html
您可能感興趣的文章
- 01-11如何實(shí)現(xiàn)點(diǎn)擊數(shù)的計(jì)算?
- 01-11如何判斷電子郵件的地址格式是否正確?
- 01-11如何做一個(gè)文本搜索?
- 01-11如何實(shí)現(xiàn)網(wǎng)上考試?
- 01-11如何實(shí)現(xiàn)全文檢索?
- 01-11如何用POP3接收電子郵件?
- 01-11如何使用表單發(fā)送電子郵件?
- 01-11如何在線更改密碼?
- 01-11如何取回已忘記的密碼?
- 01-11如何做一個(gè)隨機(jī)密碼產(chǎn)生器?


閱讀排行
本欄相關(guān)
- 01-11如何實(shí)現(xiàn)點(diǎn)擊數(shù)的計(jì)算?
- 01-11如何做一個(gè)文本搜索?
- 01-11如何判斷電子郵件的地址格式是否正
- 01-11如何實(shí)現(xiàn)全文檢索?
- 01-11如何實(shí)現(xiàn)網(wǎng)上考試?
- 01-11如何使用表單發(fā)送電子郵件?
- 01-11如何用POP3接收電子郵件?
- 01-11如何取回已忘記的密碼?
- 01-11如何在線更改密碼?
- 01-11如何做一個(gè)隨機(jī)密碼產(chǎn)生器?
隨機(jī)閱讀
- 08-05DEDE織夢data目錄下的sessions文件夾有什
- 08-05dedecms(織夢)副欄目數(shù)量限制代碼修改
- 01-10使用C語言求解撲克牌的順子及n個(gè)骰子
- 01-10C#中split用法實(shí)例總結(jié)
- 04-02jquery與jsp,用jquery
- 01-10delphi制作wav文件的方法
- 08-05織夢dedecms什么時(shí)候用欄目交叉功能?
- 01-10SublimeText編譯C開發(fā)環(huán)境設(shè)置
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 01-11ajax實(shí)現(xiàn)頁面的局部加載