html能否读txt文本文件的数据?
请教大家一个问题,html能否读txt文本文件的数据?能否举个例子?
程序代码:
<script language=vbscript> Function bytes2BSTR(vIn) strReturn = "" For i = 1 To LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode < &H80 Then strReturn = strReturn & Chr(ThisCharCode) Else NextCharCode = AscB(MidB(vIn,i+1,1)) strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) i = i + 1 End If Next bytes2BSTR = strReturn End Function </script> <script language="JavaScript"> var xmlUrl = new ActiveXObject('Microsoft.XMLHTTP'); xmlUrl.Open('GET','a255.txt'); xmlUrl.Send(); document.write(bytes2BSTR(xmlUrl.ResponseBody)); setTimeout('alert(bytes2BSTR(xmlUrl.ResponseBody))',2000); </script>把a255.txt改为你要看的txt试下!