发生了什么事? OpenTextFile.WriteLine错误: - 对象不支持属性或方法' WriteLine'

时间:2015-01-29 23:25:25

标签: javascript activexobject filesystemobject

需要一些建议请窥视......

11  <script>
12      fname='C:/Genesis 15/site/portal/proj/htm_app/pkmn/test_2.txt'
13      mode=8 // Open a file for reading
14      create=true // a new file will not be created
15      
16      xfs=new ActiveXObject('Scripting.FileSystemObject')
17      xfs.OpenTextFile(fname,mode,create)
18      xfs.WriteLine('This text will be added to the end of file')
19      xfs.Close()
20  </script>

返回: -

SCRIPT438: Object doesn't support property or method 'WriteLine'
File: default.htm, Line: 18, Column: 3

我真的不明白!

我错过了什么?

它与我在IE中使用的代码相同,因为,永远......

现在它出现了,AARRGGHH?!

1 个答案:

答案 0 :(得分:0)

解决!

    xfs=new ActiveXObject('Scripting.FileSystemObject')
    fi=xfs.OpenTextFile(fname,mode,create)
    fi.WriteLine('This text will be added to the end of file')
    fi.Close()