Escriba el código HTML en el archivo y luego genere el archivo en el formato .html
<%
FileName = test.htm
Si solicita (cuerpo) <> entonces
establecer fso = server.createObject (scripting.filesystemObject)
Establecer htmlwrite = fso.createTextFile (server.mappath (nombre de archivo))
htmlwrite.write <html> <head> <title> request.form (title) </title> </head>
htmlwrite.write <body> Contenido de título de salida: request.form (title) <br/> Contenido del cuerpo de salida: request.form (body) </body> </html>
htmlwrite.close
establecer fout = nada
Establecer FSO = nada
final si
%>
<Formulario de formulario = formato de formato = post acción =>
<Nombre de entrada = Valor de título = Title Size = 26>
<br>
<Textarea name = Body> Body </Textarea>
<br>
<br>
<input type = Subt name = Subt value = Generate HTML>
</form>
2. Sin embargo, es muy inconveniente generar el archivo HTML de acuerdo con el método anterior. Para completar la función de plantilla;
Template.htm '// archivo de plantilla
<html>
<Evista>
<title> $ title $ por jzxue.com </title>
</ablo>
<Body>
$ Cuerpo $
</body>
</html> testMplate.asp '// Generar html
<%
Dim FSO, htmlwrite
Dim strtital, strcontent, strout
'// crear un objeto del sistema de archivos
Establecer fso = server.createObject (scripting.filesystemObject)
'// Abra el archivo de plantilla web y lea el contenido de plantilla
Establecer htmlwrite = fso.opentextfile (server.mappath (Template.htm))
Struts = F. Readall
htmlwrite.close
strtital = título de la página web generada
StrContent = contenido de la página web generada
'// Use contenido real para reemplazar la marca en la plantilla
Strout = reemplazar (strout, $ title $, strtitle)
Strout = reemplazar (strout, $ body $, strcontent)
'// crear una página estática para generar
Establecer htmlwrite = fso.createTextFile (server.mappath (test.htm), verdadero)
'// escribir en el contenido web
htmlwrite.writeLine strout
htmlwrite.close
Respuesta. ¡Write genera un éxito de página estática!
'// libera el objeto del sistema de archivos
establecer htmlwrite = nada
Establecer FSO = nada
%>