gzh_seagull,多谢你回文。不过我的页面其他函数中有这样一句:
var oXMLDoc=new ActiveXObject('MSXML'); 
却是可以运行的,而且可以完成我的功能。一旦把单引号中的MSXML变成Scripting.FileSystemObject就出错。单引号与双引号也测试过,都不行。再次感谢你善意的回文。
zhanghuajun

解决方案 »

  1.   

    在IE的“INTERNET”选项里有“安全设置”方面的东东,你把那个“ActiveX控件”的设置查看一下,如果是“禁止”,那么设置为“启用”就行了。
      

  2.   

    把那段代码保存成*.hta再运行就OK了。
      

  3.   

    咿呀原来有Response,还没看到呢,这样要保存成*.asp然后通过http://***/*.asp运行就可以了,javascript要运行于服务器端。
      

  4.   

    to gzh_seagull & yannan_liv:
       非常感谢两位的帮助,搞定了,谢谢。华军
      

  5.   

    或者。
    <script>
    function ReadFiles()
    {
       var fso, f1, ts, s;
       var ForReading = 1;
       fso = new ActiveXObject("Scripting.FileSystemObject");
       f1 = fso.CreateTextFile("c:\\testfile.txt", true);
       // &ETH;&acute;&Ograve;&raquo;&ETH;&ETH;&iexcl;&pound;
       document.write("Writing file <br>");
       f1.WriteLine("Hello World");
       f1.WriteBlankLines(1);
       f1.Close();
       // &para;&Aacute;&Egrave;&iexcl;&Icirc;&Auml;&frac14;&thorn;&micro;&Auml;&Auml;&Uacute;&Egrave;&Yacute;&iexcl;&pound;
       document.write("Reading file <br>");
       ts = fso.OpenTextFile("c:\\testfile.txt", ForReading);
       s = ts.ReadLine();
       document.write("File contents = '" + s + "'");
       ts.Close();
    }
    ReadFiles();
    </script>