textarea的value是html文件源代码,存成html文件的代码
发布时间:2016-12-30 来源:查字典编辑
摘要:textarea的value是html文件源代码,如何把源代码存成html文件??如hmtl页面alert(ok);1楼dimfileNam...
textarea的value是html文件源代码,如何把源代码存成html文件??
如
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<title>hmtl页面</title>
</head>
<body>
alert(ok);
</body>
</html>
1楼
dimfileNameStr
fileNameStr=Trim(Request.Form("fileName"))
dimfileContentStr
fileContentStr=Trim(Request.Form("fileContent"))
Setfs=CreateObject("Scripting.FileSystemObject")
dimfilePath
filePath=Server.MapPath("PageURL/"&fileNameStr)
Seta=fs.CreateTextFile(filePath,True)
a.WriteLine(fileContentStr)
a.Close
2楼
在客户端实现保存的方法:
<textareaid=mmrows=8>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<title>hmtl页面</title>
</head>
<body>
alert(ok);
</body>
</html>
</textarea><br>
<inputtype=buttonvalue=saveonclick="Save()">
<SCRIPTLANGUAGE="JavaScript">
<>
</SCRIPT>