JavaScript 创建文件

var fso, tf;
fso = new ActiveXObject("Scripting.FileSystemObject");

// 创建新文件
tf = fso.CreateTextFile("c:""testfile.txt", true);

// 填写数据,并增加换行符
tf.WriteLine("Testing 1, 2, 3.") ;

// 增加3个空行
tf.WriteBlankLines(3) ;

// 填写一行,不带换行符
tf.Write ("This is a test.");

// 关闭文件
posted @ 2009-02-27 13:27  zxlin25  阅读(724)  评论(0编辑  收藏  举报