javascript能不能实时读取txt内容 我现在能实现通过javascript读取txt的内容,但是我希望5秒刷新一次内容,我是用在gadget里的。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 要结合ajax 。最简单 jquery $("#div").load("txt.txt"); <html><head> <script type="text/javascript"> <!-- function ReadFile(filespec){ var fso = new ActiveXObject("Scripting.FileSystemObject"); var file = fso.OpenTextFile(filespec); var text = file.ReadLine(); file.Close(); document.write(text); } function ReadAll() { ReadFile('D:\\dTemp.txt'); document.write("<br>"); ReadFile('D:\\dPres.txt'); document.write("<br>"); ReadFile('D:\\dHum.txt'); document.write("<br>"); ReadFile('D:\\dLum.txt'); } --> </script></head><body> <table border="1" align= "left" background="c.jpg"> <tr> <td> <table border="1" align= "left"> <tr> <td>Température <br> Pression <br> Humidity <br> Luminosité</td> </tr> </table> </td> <td> <table border="1" align= "right"> <table> <tr> <td> <script type="text/javascript" language="javascript">//下面的数据就是我想实时读的,能不能帮忙改一改 ReadFile('D:\\dTemp.txt'); document.write("<br>"); ReadFile('D:\\dPres.txt'); document.write("<br>"); ReadFile('D:\\dHum.txt'); document.write("<br>"); ReadFile('D:\\dLum.txt'); </script> </td> </tr> </td> </tr></table></body></html> 求JS高手帮忙编写JS实现二级菜单的隐藏与出现 请问:阿拉伯数字的像素是怎么算的? 向setTimeout传递this参数 【高手进】Ext 中的下拉框怎么获取里面的值 关于使用setTimeout传递变量 percent = .1 * (diffX - lastScrollX),这里的".1"是什么意思? 一个页的的contentEdittable设为true后怎样触发事件 如何用下拉列表实现头像的显示??? 哪里有好的Tab 用java mail1.2发送邮件在TOMCAT4.0下抛出IO异常——代号500?求解!!! image的URL属性问题 为什么这个node是null?
最简单 jquery
$("#div").load("txt.txt");
<head>
<script type="text/javascript">
<!--
function ReadFile(filespec){
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fso.OpenTextFile(filespec);
var text = file.ReadLine();
file.Close();
document.write(text);
}
function ReadAll()
{
ReadFile('D:\\dTemp.txt');
document.write("<br>");
ReadFile('D:\\dPres.txt');
document.write("<br>");
ReadFile('D:\\dHum.txt');
document.write("<br>");
ReadFile('D:\\dLum.txt');
}
-->
</script>
</head>
<body>
<table border="1" align= "left" background="c.jpg">
<tr>
<td>
<table border="1" align= "left">
<tr>
<td>Température
<br>
Pression
<br>
Humidity
<br>
Luminosité</td>
</tr>
</table>
</td>
<td>
<table border="1" align= "right">
<table>
<tr>
<td>
<script type="text/javascript" language="javascript">
//下面的数据就是我想实时读的,能不能帮忙改一改
ReadFile('D:\\dTemp.txt');
document.write("<br>");
ReadFile('D:\\dPres.txt');
document.write("<br>");
ReadFile('D:\\dHum.txt');
document.write("<br>");
ReadFile('D:\\dLum.txt');
</script>
</td>
</tr>
</td>
</tr>
</table>
</body>
</html>