首页 > 互联资讯 > 技术交流  > 

如何用ASP输出HTML文件?


<%
u_title=request.form("u_title")

' 检查标题是否被输入.
if u_title = "" then
%>

">


文件标题


Font Size


1


2

提交
" >



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

' 如果有一个用户输入了标题,则获取所有的用户输入的内容.

set fso = createobject("scripting.filesystemobject")
Set act = fso.CreateTextFile(server.mappath("write2htm/"&g_filename & "-"& month(date())& day(date())& year(date()) &".htm"), true)
'
创建create the text (html) file文件到服务器,并添加mmddyyyy 格式年月日.

'
写所有用户输入的text (html) 文件, .htm 扩展名文件可以很容易地转换成你网站最需要的.asp .inc文件.
act.WriteLine ""
act.WriteLine chr(13)
act.WriteLine ""& u_title &""
act.WriteLine chr(13)
act.WriteLine ""
act.WriteLine chr(13)
act.WriteLine "

"
act.WriteLine chr(13)
act.WriteLine u_title &"

"
act.WriteLine chr(13)
act.WriteLine "

"
act.WriteLine chr(13)
act.WriteLine u_paragraph1 &"

"
act.WriteLine chr(13)
act.WriteLine "

"
act.WriteLine chr(13)
act.WriteLine u_paragraph2 &"

"
act.WriteLine chr(13)
act.WriteLine "

"
act.WriteLine "

"
act.WriteLine "此文件被创建!"
act.WriteLine now() &"

"
act.Close

' 关闭文件.
%>
您的页面已成功创建!请点击查看.
.htm"
target="_blank">
查看




<% response.write ""
response.write chr(13)
response.write ""& u_title &""
response.write chr(13)
response.write ""
response.write chr(13)
response.write "

"
response.write chr(13)
response.write u_title &"

"
response.write chr(13)
response.write "

"
response.write chr(13)
response.write u_paragraph1 &"

"
response.write chr(13)
response.write "

"
response.write chr(13)
response.write u_paragraph2 &"

"
response.write chr(13)
response.write "

"
response.write "

"
response.write "此文件被创建!"
response.write now() &"

"
end if
%>

如何用ASP输出HTML文件?由讯客互联技术交流栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“如何用ASP输出HTML文件?