生成文件的js代码

<html>

<body onload="WriteTxt();">

</body>

</html>

<script >

function WriteTxt() 

{ 

   for(i=0;i<20;i++){ 

    var fso, tf; 

    fso = new ActiveXObject("Scripting.FileSystemObject"); 

    tf = fso.CreateTextFile("C://Documents and Settings//All Users//桌面//测试"+i+".txt", true); 

    tf.WriteLine("123") ; 

    tf.Close(); 

   }

    

} 

</script>

你可能感兴趣的:(js)