<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>
<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>
解决方案 »
- jquery bug?
- document.getElementById("othermesstext").innerHTML 的问题
- 请教一个js选择的效果
- 将所有特殊符号替换为-
- 也不知道这个问题难不难,如何屏蔽鼠标滚轮事件?
- 一个Option对象 是否可以add给两个select
- 紧急求救:怎样把输入框里的内容自动保存成文本文档,比如保存成bb.txt,在这里bb.txt本身不存在是自动生成的.
- jquery 关于超链接变色问题
- 在一个函数里要调用别的文件夹下的html文件里的函数,格式应该怎么写??????谢谢
- 高分求救?100
- showModalDialog如果关闭子窗口后自动刷新父窗口?怎么实现?
- 我该怎样跳出这个循环
setTimeout(function(){
//dosomething
}, 1000);
不就行了?
还有用setInterval
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');
setTimeout(function(){Read()},1000);
}
ReadAll();
但是一刷新就表格什么的都没了,而且只有第一秒刷新,后就不动了。