定时存取文本文件需要调用一个ActiveXObject:
<script language="javascript">
function getData(){
var oXML = new ActiveXObject("MSXML2.XMLHTTP");
oXML.open("GET","2.txt",false);
oXML.send();
div1.innerHTML=oXML.responseText;
}
要用服务器端代码
asp的:
%
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set fil=fso.OpenTextFile(Server.MapPath("liuyan.ini"),1)
na=fil.ReadAll
fil.close
mystr=split(na," ")
for i=0 to mystr.Count-1
Response.Write mystr(i)
next
%>