. <script language="javascript" type="text/javascript">
. object.OpenTextFile(filename[, iomode[, create[, format]]])
. 必选项。object 应为 FileSystemObject 的名称。
. 可选项。可以是三个常数之一:ForReading 、 ForWriting 或 ForAppending 。
. 可选项。Boolean 值,指明当指定的 filename 不存在时是否创建新文件。如果创建新文件则值为 True ,如果不创建则为 False 。如果忽略,则不创建新文件。
. 可选项。使用三态值中的一个来指明打开文件的格式。如果忽略,那么文件将以 ASCII 格式打开。
. ForReading 1 以只读方式打开文件。不能写这个文件。
. ForAppending 8 打开文件并从文件末尾开始写。
. TristateTrue 以 Unicode 格式打开文件。
. TristateFalse 以 ASCII 格式打开文件。
. TristateUseDefault 使用系统默认值打开文件。
. function readFile(filename){
. var fso = new ActiveXObject("Scripting.FileSystemObject");
. var f = fso.OpenTextFile(filename,1);
. while (!f.AtEndOfStream)
. s += f.ReadLine()+"\n";
. function writeFile(filename,filecontent){
. fso = new ActiveXObject("Scripting.FileSystemObject");
. f = fso.OpenTextFile(filename,8,true);
. f.WriteLine(filecontent);
. <input type="text" id="in" name="in" />
. <input type="button" value="Write!" onclick="writeFile('c:/12.txt',document.getElementById('in').value);"/><br><br>
. <input type="button" value="Read!" onclick="document.getElementById("__content").value=readFile('http://sc.stock.cnfol.com/090917/123,1282,6534044,00.shtml');"/><br>
. <textarea id="show" name="show" cols="100" rows="https://cdn.jxasp.com:9143/image/20" >