注册 登录
编程论坛 ASP技术论坛

我想请教一个问题!!!

疯狂的探索者 发布于 2007-11-22 17:53, 603 次点击
我想利用asp页面生成html页面,谁有这样的代码,共享一下行吗?
拜托了!!!
6 回复
#2
疯狂的探索者2007-11-22 18:01
没人知道吗
#3
icecool2007-11-22 20:46
用如下方法(FSO)可以生成:

index.asp   (生成静态页代码)
-----------------------------------------------------------

<%
fname="template.htm"
dim replaceweb(2)
replaceweb(0)="haha"
replaceweb(1)="模版生成静态页面"
replaceweb(2)="模版生成静态页面实例"
set fso=server.createobject("scripting.filesystemobject")
set file=fso.opentextfile(server.mappath(fname),1,True)
FSOFileRead = file.ReadAll
set file=nothing
for i=0 to 2
 FSOFileRead=Replace(FSOFileRead,"$HTMLWEB["&i&"]",replaceweb(i))
next
Set outfile = fso.CreateTextFile(Server.Mappath("newweb.htm"))
outfile.Write FSOFileRead
outfile.close
Set outfile=nothing
Set fso=nothing
%>

template.htm  (模板)
----------------------------------------------------
<html>
<head>
<title>$HTMLWEB[0]</title>
</head>
<body>
<center>
<h1>$HTMLWEB[1]</h1><hr>
$HTMLWEB[2]
</center>
</body>
</html>
#4
madpbpl2007-11-23 01:05
学习!
#5
疯狂的探索者2007-11-23 08:34
谢谢了!我试试.:handshake
#6
ookiss2007-11-23 08:36
不太会用啊?能不能说的详细一点啊?谢谢了。
#7
ookiss2007-11-23 08:53
小版主呢?呵呵。帮帮忙嘛。
1