JS文件操作
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JS文件操作</title>
<script type="text/javascript">
function creatFile(){
var fso, ts;
var ForWriting= 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
ts = fso.OpenTextFile("d:\\test.txt", ForWriting, true);//创建
// 写一行,并且带有新行字符。
ts.WriteLine("Testing 1, 2, 5.") ;//写入
// 向文件写三个新行字符。
ts.WriteBlankLines(3) ;
// 写一行。
ts.Write ("This is a test.");
ts.Close(); //关闭
}
</script>
</head>
<body>
<input type="button" value="creatFile" onclick="creatFile()"/>
</body>
</html> 相关推荐
gufudhn 2020-06-06
Zhongmeishijue 2020-09-10
runner 2020-09-01
梦的天空 2020-08-25
IdeaElements 2020-08-19
luvhl 2020-08-17
移动开发与培训 2020-08-16
ReunionIsland 2020-08-16
lyqdanang 2020-08-16
NARUTOLUOLUO 2020-08-03
MyNameIsXiaoLai 2020-07-08
星辰的笔记 2020-07-04
csstpeixun 2020-06-28
letheashura 2020-06-26
liaoxuewu 2020-06-26
OldBowl 2020-06-26
北京老苏 2020-06-25
Luffyying 2020-06-25