主页所停留的时间实现交互
<html>
<body>
<form name="myform">
<td vAlign="top" width="135">你在此停留了:
<input name="clock" size="8" value="在线时间">
</td>
</form>
<script Language="JavaScript">
var id,im=0,is=1;
start = new Date();
function go(){
now = new Date();
time = (now.getTime()-start.getTime())/1000;
time = Math.floor(time);
is = time%60;
im = Math.floor(time/60);
document.myform.clock.value=""+im+"分"+is+"秒";
id=setTimeout("go()",1000);
}
go();
</script>
</body>
</html>
<body>
<form name="myform">
<td vAlign="top" width="135">你在此停留了:
<input name="clock" size="8" value="在线时间">
</td>
</form>
<script Language="JavaScript">
var id,im=0,is=1;
start = new Date();
function go(){
now = new Date();
time = (now.getTime()-start.getTime())/1000;
time = Math.floor(time);
is = time%60;
im = Math.floor(time/60);
document.myform.clock.value=""+im+"分"+is+"秒";
id=setTimeout("go()",1000);
}
go();
</script>
</body>
</html>