var val= document.getElementById("printDiv").innerHTML;
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 (val);
tf.Close();//关闭