首页
印 像 新 闻 系 统
网站首页 公告信息 编程实例 PHP函数 摄影无界 全景展示 我的作品 意见专栏
 

ASP动态生成HTML

【2006年01月20日 13:30:52】 【阅读:次】 【字体:大 中 小 默认】 【背景:#换背景 #换背景 #换背景 #换背景 #换背景 #换背景 #换背景 默认】

<html>
<head>

<title>HTML生成器</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
 msg=request.Form("msg")
 title=request.Form("title")
if title="" or msg="" then
  response.write "标题不能为空"
  response.end()
end if
function chan_time(shijian)转换日期时间函数
 s_year=year(shijian)
 if len(s_year)=2 then s_year="20"&s_year
 s_month=month(shijian)
 if s_month<10 then s_month="0"&s_month
 s_day=day(shijian)
 if s_day<10 then s_day="0"&s_day
 s_hour=hour(shijian)
 if s_hour<10 then s_hour="0"&s_hour
 s_minute=minute(shijian)
 if s_minute<10 then s_minute="0"&s_minute
 chan_time=s_year & s_month & s_day & s_hour & s_minute
end function

function chan_data(shijian)  转换日期时间函数
 s_year=year(shijian)
 if len(s_year)=2 then s_year="20"&s_year
 s_month=month(shijian)
 if s_month<10 then s_month="0"&s_month
 s_day=day(shijian)
 if s_day<10 then s_day="0"&s_day
 chan_data=s_year & s_month & s_day
end function

function chan_file(shijian)转换日期时间函数
 s_month=month(shijian)
 if s_month<10 then s_month="0"&s_month
 s_day=day(shijian)
 if s_day<10 then s_day="0"&s_day
 s_hour=hour(shijian)
 if s_hour<10 then s_hour="0"&s_hour
 s_minute=minute(shijian)
 if s_minute<10 then s_minute="0"&s_minute
 s_ss=second(shijian)
 if s_ss<10 then s_ss="0"&s_ss
 chan_file = s_month & s_day & s_hour & s_minute & s_ss
end function

 For i = 1 To Request.Form("msg").Count
        sContent = sContent & Request.Form("msg")(i)
 Next
 sContent=replace(sContent,"","")
 top="top<br><br><br>"
 
 eoff="<br><br><br>foot"
 
 msg=ubb_htm(msg)

 Set fs=Server.CreateObject("Scripting.FileSystemObject")
 MyFolder=server.mappath("files_info")
 If NOT fs.folderexists(MyFolder) then
    fs.createfolder(MyFolder)
 End If 
 all_tree2=server.mappath("files_info")&"\"&chan_data(now())
 if not (fs.FolderExists(all_tree2)) then判断今天的文件夹是否存在
    fs.CreateFolder(all_tree2)
 end if
 pass=chan_file(now)
 randomize  使用系统计时器来初始化乱数产生器
 pass=rnd(pass)
 pass=get_pass(pass)
 pass=left(pass,10)
 
 abcd=int(len(msg)/4000)

if abcd=0 then
 file1=pass
 files=file1&".htm"
 contents1=chan_data(now())&"\"&files
 filez=all_tree2&"\"&files
 set ts = fs.createtextfile(filez,true)
 msgg=top&msg&eoff
  for z=1 to len(msgg)
   write_now=mid(msgg,z,1)
   ts.write(write_now)
  next
else
bb=1

abc=abcd
for a=1 to abcd+1
   file1=pass
   files=file1&"_"&a&".htm"
   href=href&"<a href="&files&">"&a&"</a>&nbsp;&nbsp;"
next
eof_t="<br><br><table width=200 border=0 align=center cellpadding=0 cellspacing=0><tr><td><div align=center>"&href&"</div></td></tr></table><br>"
 for a=1 to abc+1
   file1=pass
   files=file1&"_"&a&".htm"
   contents1=chan_data(now())&"\"&file1&"_1.htm"
   filez=all_tree2&"\"&files
   set ts = fs.createtextfile(filez,true)

   msgg=mid(msg,bb,4000)
   msgg=top&msgg&eof_t&eoff
      for z=1 to len(msgg)
        write_now=mid(msgg,z,1)
        ts.write(write_now)
      next
   bb=bb+4000
 next
 
end if
 ts.close
 set ts=nothing    文件生成

 if err.number<>0 or err then%>
 
   alert("不能完成")
 
 <%
 else
 %>
 
 alert("已完成")
 history.back();

 <%
 end if

function get_pass(pass)

 pass=cstr(pass)
 pass=replace(pass," ","")
 pass=replace(pass," ","")
 pass=replace(pass,"-","")
 pass=replace(pass," ","")
 pass=replace(pass,":","")
 pass=replace(pass,".","")
 pass=replace(pass,"+","")
 pass=replace(pass,"_","")
 pass=replace(pass,"<","")
 pass=replace(pass,">","")
 pass=replace(pass,"!","")
 pass=replace(pass,"@","")
 pass=replace(pass,"#","")
 pass=replace(pass,"$","")
 pass=replace(pass,"%","")
 pass=replace(pass,"^","")
 pass=replace(pass,"&","")
 pass=replace(pass,"*","")
 pass=replace(pass,"(","")
 pass=replace(pass,")","")
 pass=replace(pass,"=","")
 pass=replace(pass,"\","")
 pass=replace(pass,"/","")
 pass=replace(pass,"|","")
 get_pass=pass
end function
%>
</body>
</html>

UBB接下


(『印像空间』 【本文来源:『学习笔记』】 【作者:未知】 【录入:留印】)
限200字,剩余 字
关 键 字:
    
搜索条件: