js操作txt

来源:互联网 发布:济宁行知中学 编辑:程序博客网 时间:2024/05/18 02:10
function CreateFile()
     {
        var fso, tf;
        fso = new ActiveXObject("Scripting.FileSystemObject");
        tf = fso.CreateTextFile("c:\\testfile.txt", true);
        // 写一行,并且带有新行字符。
        tf.WriteLine("Testing 1, 2, 3.") ;
        // 向文件写三个新行字符。 
        tf.WriteBlankLines(3) ;
        // 写一行。
        tf.Write ("This is a test.");
        tf.Close();
     }
原创粉丝点击