js如何在本地生成文件
如题!
[解决办法]
用ie的FileSystemObject对象,但只能在ie中运行,以下是例子:
var fso = new ActiveXObject("Scripting.FileSystemObject");var a = fso.CreateTextFile("c:\\testfile.txt", true);a.WriteLine("This is a test.");a.Close();
[解决办法]
<html> <head> </head> <body> <script language="Javascript"><!-- var fso = new ActiveXObject("Scripting.FileSystemObject"); var a = fso.CreateTextFile("c://yourfile.txt", true); a.WriteLine("This is a test."); a.Close(); alert("我已经在你的C盘根目录下生成了一个testfile.txt的文件!"); // --></script> </body> </html>