日期:2014-05-16 浏览次数:20461 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <SCRIPT LANGUAGE="JavaScript"> function ReadFiles() { try { var fso = new ActiveXObject("Scripting.FileSystemObject") } catch(e){ alert("您的浏览器安全级别太高,无法保存,请调整您的安全级别到低") return; } var ts,s; var ForReading = 1; //定义数组 var clientsDate = new Array(); //读取文件的内容。 ts = fso.OpenTextFile("f:\\wms.ini",ForReading,true); while(!ts.AtEndOfStream){ s = ts.ReadLine(); clientsDate.push(s); //document.write(s); } ts.Close(); //迭代弹出读取文件的数据 for(var i=0;i<clientsDate.length;i++){ alert(clientsDate[1]); } } </SCRIPT> </head> <input type="button" value="读取" onclick="ReadFiles();"/> <body> </body> </html>?