如何用ASP輸出HTML文件?
來源:易賢網(wǎng) 閱讀:1853 次 日期:2014-08-09 15:22:11
溫馨提示:易賢網(wǎng)小編為您整理了“如何用ASP輸出HTML文件?”,方便廣大網(wǎng)友查閱!

<!--#include file="top.inc"-->

<%

u_title=request.form("u_title")

' 檢查標(biāo)題是否被輸入.

if u_title = "" then

%>

<form method="POST" action="<%= request.servervariables("script_name") %>">

<!--當(dāng)沒有標(biāo)題輸入時顯示輸入框-->

<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," ","_")

' 如果有一個用戶輸入了標(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)建!請點擊查看.

<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"-->

更多信息請查看IT技術(shù)專欄

更多信息請查看網(wǎng)絡(luò)編程
易賢網(wǎng)手機(jī)網(wǎng)站地址:如何用ASP輸出HTML文件?
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

2025國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機(jī)號
  • 驗證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 加入群交流 | 手機(jī)站點 | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
云南網(wǎng)警備案專用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
咨詢QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報警專用圖標(biāo)