标题:帮忙解释下这段ASP生成HTMl的代码
取消只看楼主
lijiong520
Rank: 1
等 级:新手上路
帖 子:154
专家分:0
注 册:2007-5-21
 问题点数:0 回复次数:3 
帮忙解释下这段ASP生成HTMl的代码
<%
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
 top="<html><head><title>news</title></head><body>"
 botom="</body></html>"
 msg=request.Form("msg")
 msg=replace(msg,vbcrlf,"")
 msg=replace(msg,chr(9),"")
 msg=replace(msg," ","&nbsp;")
 msg=replace(msg,"\r\n","<br>")
 msg=replace(msg,"\n","<br>")
 msg=top&msg&botom
 Set fs=Server.CreateObject("scripting.FileSystemObject")
 all_tree2=server.mappath("news")&"\"&chan_data(now)
 if (fs.FolderExists(all_tree2)) then'判断今天的文件夹是否存在
 else
 fs.CreateFolder(all_tree2)
 end if   
 pass=chan_file(now)
 randomize  '使用系统计时器来初始化乱数产生器
 pass=rnd(pass)
 pass=get_pass(pass)
 pass=left(pass,10)
file1=pass
 files=file1&".txt"
 filez=all_tree2&"\"&files


 set ts = fs.createtextfile(filez,true) '写文件
 for z=1 to len(msg)
  write_now=mid(msg,z,1)
  ts.write(write_now)
 next
' ts.writeline(all_msg)
 ts.close
 set ts=nothing    '文件生成


 if err.number<>0 or err then%>
  <script language="javascript">
   alert("不能完成")
  </script>
 <%else%>
  <script language="javascript">
 alert("已完成")
 history.back();
  </script>
 <%end if
 Set MyFile = fs.GetFile(filez)
 all_tree2=server.mappath("news")&"\"&chan_data(now)
 if (fs.FolderExists(all_tree2)) then
 else
 fs.CreateFolder(all_tree2)
 end if
 MyFile.name= left(MyFile.name,len(MyFile.name)-4)&".htm"
 set MyFile=nothing
 set fs=nothing
 set fdir=nothing
function get_pass(pass)


 pass=cstr(pass)
 pass=replace(pass," ","")
 pass=replace(pass,"@","")
 get_pass=pass
end function
 
%>


谢谢大家,最好一句一句解释下,非常谢谢!
搜索更多相关主题的帖子: minute hour year shijian month 
2008-05-07 16:12
lijiong520
Rank: 1
等 级:新手上路
帖 子:154
专家分:0
注 册:2007-5-21
得分:0 
好人们,没想到,真多代码一句一句给解释下来了,非常的谢谢你们! 
问下 现在ASP生成HTMl的,  比如一个新闻系统   新闻列表页是不是ASP的,  单个新闻页是HTMl  还是都是HTMl的!    

如果都是HTMl的,那新闻列表页如果再想新加几条新闻  咋办!
2008-05-08 11:35
lijiong520
Rank: 1
等 级:新手上路
帖 子:154
专家分:0
注 册:2007-5-21
得分:0 
谁那有ASP生成HTMl的简单网页!         不好整站的太多了,  几个-20个之间的都行,主要看一下咋做里! 我QQ: 591625390
2008-05-08 11:45
lijiong520
Rank: 1
等 级:新手上路
帖 子:154
专家分:0
注 册:2007-5-21
得分:0 
我邮箱 lijionglove1314@   给给我一份谢谢
2008-05-08 15:52



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-212978-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.222266 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved