如何用ASP输出HTML文件?
发布时间:2010-06-11 20:01:00
如何用ASP输出HTML文件?
<!--#include file="top.inc"-->
<%
u_title=request.form("u_title")
' 检查标题是否被输入
if u_title = "" then
%>
<form method="POST" action="<%= request.servervariables("script_name") %>">
<!--当没有标题输入时显示输入框-->
<p>文件标题<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," ","_")
' 如果有一个用户输入了标题,则获取所有的用户输入的内容
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 "<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 "此文件被创建!"
act.WriteLine now() &"</p>"
act.Close
' 关闭文件
%>
您的页面已成功创建!请点击查看.
<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 "此文件被创建!"
response.write now() &"</p>"
end if
%>
<!--#include file="bottom.inc"-->
猜你喜欢
- 防止一般的采集以及小偷读取,加在顶部。同理,可以改造成JS脚本。下面的方法是通过选择同一IP的访问频率来达到防止采集的目的,就是可能也把搜索
- MySQL目前不支持列的Default 为函数的形式,如达到你某列的默认值为当前更新日期与时间的功能,你可以使用TIMESTAMP列类型下面
- 求3721,163,1,4832,1980,2008,68686688,9999,17173,5173,8848中最大的数明白后,试着求一下
- 这10个asp处理网页编码转换的函数,不知何时收藏在我的电脑中,今天刚好看到了,拿出来与大家分享,这里各种常见的网页编码问题已经
- 在本文中,此示例标准蓝图的存储过程命名方法只适用于SQL内部,假如你正在创建一个新的存储过程,或是发现一个没有按照这个标准构造的存储过程,即
- 很开心可以和导师阿坚在08gui大赛中一起去完成《fight》的图标设计,在这个过程中真的是受益匪浅!这里我谈一下在这个过程的一些小小心得。
- asp时间加减运算 和转换问题 a=2007-07-24 2:23:15 b=2005-06-25 2:23:15 问题1 如何将a转换成2
- 可用下面提供的强制登录的程序,它也可以用来做会员注册的。security.asp<%bLoggedIn =&nb
- 经过了上个星期的努力学习,对处理html又有了新的发现感觉真的很不错可以说js的威力在处理html代码方面我又有所领悟了1、截取特定长度字符
- ACCESS数据库在用的过程中,经常不断的进行删除和增加记录的操作,会出现以下问题:1、可能会使Update语句更新失败,明明一条记录存在,
- by leecade :我聊下我的想法 从功能上看,能不能把JS分成3层结构1 语法设计,选择器,常用函数2 业务逻辑(比如封装好常用的TA
- 数据库复制:简单来说,数据库复制就是由两台服务器,主服务器和备份服务器,主服务器修改后,备份服务器自动修改。复制的模式有两种:推送模式和请求
- 看看上一篇《javascript设计模式交流(一)Singleton Pattern》本文将讨论Prototype Pattern的js实现
- MaxDB和MySQL是独立的数据库管理服务器。系统间的协同性是可能的,通过相应的方式,系统能够彼此交换数据。要想在MaxDB和MySQL之
- 写过稍微大型一点 ASP 的人都知道,Session 这个对象真是好用,它可以用来记录使用者私有的资料变量,既安全又方便。但是你真的知道 S
- 平时我们获取事件对象一般写法如下:function getEvent(event) { return event
- 人类学是关于人的研究;社会人类学(social anthropology)是研究人类社会的学科。社会人类学还可以理解成“文化翻译”(the
- 说到 IE 的 bug,一个臭名昭著的例子是它对于“盒模型”的错误解释:在 IE5.x 以及 Quirks 模式的 IE6/7 中,将 bo
- 经常在工作中会使用到XPath的相关知识,但每次总会在一些关键的地方不记得或不太清楚,所以免不了每次总要查一些零碎的知识,感觉即很烦又浪费时
- 静态页面是蜘蛛喜欢的,会得到蜘蛛经常光顾的,以至于网站上的内容会得到搜索引擎更多的收录。这里介绍一个asp伪静态的程序实现方法数据库是acc