How can I use ASP to output HTML files?

Source: Internet
Author: User

<! -- # Include file = "top. inc" -->
<%
U_title = request. form ("u_title ")

'Check whether the title is entered.
If u_title = "" then
%>
<Form method = "POST" action = "<% = request. servervariables (" script_name ") %>">
<! -- Display the input box when no title is entered -->

<P> file title <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> section 1st <br>
<Textarea rows = "2" name = "u_paragraph1" cols = "35"> </textarea> </p>
<P> section 2nd <br>
<Textarea rows = "2" name = "u_paragraph2" cols = "35"> </textarea> <input type = "submit" value = "submit"> </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 ,"","_")

'If a user has entered a title, all user input is obtained.

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 to the server and add the mmddyyyy format year, month, and day.

'Write all text (html) files entered by the user. The. htm extension file can be easily converted into the. asp or. inc file most needed by your website.
Act. WriteLine "Act. WriteLine chr (13)
Act. WriteLine "<title>" & u_title & "</title>"
Act. WriteLine chr (13)
Act. WriteLine "<body bgcolor = '# ffff'>"
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>"
Act. WriteLine "<p align = 'center'> <font face = 'arial' size = '" & u_text_size & "'>"
Act. WriteLine "this file is created! "
Act. WriteLine now () & "</p>"
Act. Close

'Close the file.
%>
Your page has been created successfully! Click to view details.
<A href = "write2htm/<% = g_filename &"-"& month (date () & day (date () & year (date () %>. htm"
Target = "_ blank"> View </a>
<Br>
<Br>
<% Response. write "Response. write chr (13)
Response. write "<title>" & u_title & "</title>"
Response. write chr (13)
Response. write "<body bgcolor = '# ffff'>"
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>"
Response. write "<p align = 'center'> <font face = 'arial' size = '" & u_text_size & "'>"
Response. write "this file is created! "
Response. write now () & "</p>"
End if
%>
<! -- # Include file = "bottom. inc" -->

Related Article

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.