textarea的value是html文件源代码,存成html文件的代码
2007-04-20 00:00
183 查看
textarea的value是html文件源代码,如何把源代码存成html文件??
如
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>hmtl页面</title>
</head>
<body>
alert(ok);
</body>
</html>
1楼
dim fileNameStr
fileNameStr = Trim(Request.Form("fileName"))
dim fileContentStr
fileContentStr = Trim(Request.Form("fileContent"))
Set fs = CreateObject("Scripting.FileSystemObject")
dim filePath
filePath = Server.MapPath("PageURL/" & fileNameStr)
Set a = fs.CreateTextFile(filePath, True)
a.WriteLine(fileContentStr)
a.Close
2楼
在客户端实现保存的方法:
<textarea id=mm style="width: 500" rows=8>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>hmtl页面</title>
</head>
<body>
alert(ok);
</body>
</html>
</textarea><br>
<input type=button value=save onclick="Save()">
<SCRIPT LANGUAGE="JavaScript">
<!--
function Save()
{
var txt = document.all.mm;
var ww = window.open("", "_blank", "width=100px, height=100px");
ww.document.write(txt.value);
ww.document.close();
ww.document.execCommand('SaveAs');
//ww.document.execCommand('Saveas',false,'c:\\test.htm');
ww.close();
}
//-->
</SCRIPT>
如
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>hmtl页面</title>
</head>
<body>
alert(ok);
</body>
</html>
1楼
dim fileNameStr
fileNameStr = Trim(Request.Form("fileName"))
dim fileContentStr
fileContentStr = Trim(Request.Form("fileContent"))
Set fs = CreateObject("Scripting.FileSystemObject")
dim filePath
filePath = Server.MapPath("PageURL/" & fileNameStr)
Set a = fs.CreateTextFile(filePath, True)
a.WriteLine(fileContentStr)
a.Close
2楼
在客户端实现保存的方法:
<textarea id=mm style="width: 500" rows=8>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>hmtl页面</title>
</head>
<body>
alert(ok);
</body>
</html>
</textarea><br>
<input type=button value=save onclick="Save()">
<SCRIPT LANGUAGE="JavaScript">
<!--
function Save()
{
var txt = document.all.mm;
var ww = window.open("", "_blank", "width=100px, height=100px");
ww.document.write(txt.value);
ww.document.close();
ww.document.execCommand('SaveAs');
//ww.document.execCommand('Saveas',false,'c:\\test.htm');
ww.close();
}
//-->
</SCRIPT>
相关文章推荐
- textarea的value是html文件源代码,存成html文件的代码
- 在asp.net中生成html文件代码
- 解决 textarea 没有value 无法显示默认文字
- java的Map集合中按value值进行排序输出的实例代码
- TextArea设置MaxLength的代码(未测试在不同浏览器下的兼容性)
- js插入字符到textarea的效果代码
- 错误代码: An instance 0xc346000 of class UITableView was deallocated while key value observers were stil
- 怎么使用SVN将本地源代码提交至码云托管。代码托管必备
- 动态调整textarea中字体的大小代码
- 图像库---Image Datasets---OpenSift源代码---openSurf源代码
- swift详解之二十--------在xcode中使用git管理源代码,将代码提交到github
- C# 里怎样得到当前执行的函数名,当前代码行,源代码文件名(转载)
- 在textarea中屏蔽js的某个function的javascript代码
- 在第一个input框内输入内容.textarea自动得到第一个文件框的值的javascript代码
- 将html源代码规范化,转换成XSL代码的asp工具
- 清空代码防止查看源代码
- Eclipse自动补全设置与Eclipse源代码下载 以前使用VisualStudio和Sublime写代码的时候有很完善的代码提示,但是最近开始使用Eclipse弄JAVA的时候发现它的代码提示不
- 同样的请求img代码,单个html文件和项目中的html文件请求结果不一样
- 把html页面的部分内容保存成新的html文件的jquery代码