Example demo: Using ASP to generate HTML files

Source: Internet
Author: User
Generate HTML

A total of two pages index.htm is the first page. The program is simple, mainly using the ASP file Operation object.

<!--index.htm---------------------->

<! Doctypehtmlpublic "-//w3c//dtdhtml4.01transitional//en"
"" >
<title>UntitledDocument</title>
<metahttp-equiv= "Content-type" content= "text/html;charset=gb2312" >

<body>
<tablewidth= "770" border= "0" align= "center" cellpadding= "0" cellspacing= "0" >
<tr>
<td><formname= "Form1" method= "Post" action= "send.asp" >
<tablewidth= "100%" border= "0" cellpadding= "0" cellspacing= "0" bgcolor= "#CCFFFF" >
<tr>
<tdheight= "><divalign=" "Center" > Send Message </div></td>
</tr>
<tr>
<td><divalign= "Center" >
<textareaname= "MSG" cols= "rows=" "6" ></textarea>
</div></td>
</tr>
<tr>
<td><divalign= "Center" >
<inputtype= "Submit" name= "submit" value= "Submit" >
<inputtype= "Reset" name= "Submit2" value= "reset" >
</div></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>

'//send.asp

<%
Functionchan_time (Shijian) ' Convert date-time function
S_year=year (Shijian)
Iflen (s_year) =2thens_year= "&s_year"
S_month=month (Shijian)
Ifs_month<10thens_month= "0" &s_month
S_day=day (Shijian)
ifs_day<10thens_day= "0" &s_day
S_hour=hour (Shijian)
Ifs_hour<10thens_hour= "0" &s_hour
S_minute=minute (Shijian)
Ifs_minute<10thens_minute= "0" &s_minute
Chan_time=s_year&s_month&s_day&s_hour&s_minute
Endfunction

Functionchan_data (Shijian) ' Convert date-time function
S_year=year (Shijian)
Iflen (s_year) =2thens_year= "&s_year"
S_month=month (Shijian)
Ifs_month<10thens_month= "0" &s_month
S_day=day (Shijian)
ifs_day<10thens_day= "0" &s_day
Chan_data=s_year&s_month&s_day
Endfunction

Functionchan_file (Shijian) ' Convert date-time function
S_month=month (Shijian)
Ifs_month<10thens_month= "0" &s_month
S_day=day (Shijian)
ifs_day<10thens_day= "0" &s_day
S_hour=hour (Shijian)
Ifs_hour<10thens_hour= "0" &s_hour
S_minute=minute (Shijian)
Ifs_minute<10thens_minute= "0" &s_minute
S_ss=second (Shijian)
ifs_ss<10thens_ss= "0" &s_ss
Chan_file=s_month&s_day&s_hour&s_minute&s_ss
Endfunction
top= "Botom= "</body>Msg=request. Form ("MSG")
Msg=replace (Msg,vbcrlf, "")
Msg=replace (MSG,CHR (9), "")
Msg=replace (MSG, "", "")
Msg=replace (msg, "\ r \ n", "<br>")
Msg=replace (msg, "\ n", "<br>")
Msg=top&msg&botom
Setfs=server.createobject ("Scripting.FileSystemObject")
All_tree2=server.mappath ("News") & "\" &chan_data (now)
if (fs. FolderExists (all_tree2)) Then ' Judge if today's folder exists
Else
Fs. CreateFolder (ALL_TREE2)
endif
Pass=chan_file (now)
Randomize ' uses the system timer to initialize the number of Chaos generator
Pass=rnd (pass)
Pass=get_pass (pass)
Pass=left (pass,10)

File1=pass
files=file1& ". txt"
filez=all_tree2& "\" &files

Setts=fs.createtextfile (filez,true) ' Write file
Forz=1tolen (msg)
Write_now=mid (msg,z,1)
Ts.write (Write_now)
Next
' Ts.writeline (all_msg)
Ts.close
Setts=nothing ' File generation

Iferr.number<>0orerrthen%>
<scriptlanguage= "JavaScript" >
Alert ("Cannot complete")
</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.