Tulis kode HTML ke dalam file dan kemudian buat file dalam format .html
<%
FileName = test.htm
Jika permintaan (tubuh) <> lalu
atur fso = server.createObject (scripting.filesystemObject)
Setel htmlwrite = fso.createTextFile (server.mappath (nama file))
htmlwrite.write <html> <head> <title> request.Form (title) </iteme> </head>
htmlwrite.write <body> Konten Judul Output: Request.Form (title) <br/> Output Badan Konten: Request.Form (Body) </body> </html>
htmlwrite.close
atur fout = tidak ada
atur fso = tidak ada
akhiri jika
%>
<Form Name = Form Metode = Post Action =>
<Input Name = Judul Nilai = Ukuran Judul = 26>
<br>
<TextArea Name = Body> Body </pextarea>
<br>
<br>
<Input Tipe = Kirim Nama = Kirim Nilai = Hasilkan HTML>
</form>
2. Namun, sangat tidak nyaman untuk menghasilkan file HTML sesuai dengan metode di atas. Untuk melengkapi fungsi template;
template.htm '// file template
<Html>
<head>
<title> $ title $ by jzxue.com </title>
</head>
<body>
$ Tubuh $
</body>
</html> testmplate.asp '// menghasilkan html
<%
Redup fso, htmlwrite
Redup strtital, strcontent, strout
'// Buat objek sistem file
Atur fso = server.createObject (scripting.filesystemObject)
'// buka file template web dan baca konten template
Setel htmlwrite = fso.opentextFile (server.mappath (template.htm))
Strout = f.readall
htmlwrite.close
strtital = judul halaman web yang dihasilkan
Strcontent = konten halaman web yang dihasilkan
'// Gunakan konten nyata untuk mengganti tanda di templat
Strout = ganti (strout, $ title $, strtitle)
Strout = ganti (strout, $ body $, strcontent)
'// Buat halaman statis yang akan dihasilkan
Setel htmlwrite = fso.createTextFile (server.mappath (test.htm), true)
'// Tulis ke dalam konten web
htmlwrite.writeLine Strout
htmlwrite.close
Response.write menghasilkan keberhasilan halaman statis!
'// Lepaskan objek sistem file
atur htmlwrite = tidak ada
atur fso = tidak ada
%>