<html>
<head>
<title>clock</title>
<script language="javascript">
var timerID = null; //Here
var timerRunning = false;
function stopClock() {
if (timerRunning)
{
clearTimerout(timerID);
timerRunning = false;
document.clock.face.value = "";
}
}
function showTimer(){
//timerID =setTimeout("showTimer()",1000); //Here
var now =new Date();
var year= now.getYear();
var month = now.getMonth() + 1 ;
var date = now.getDate();
var hours = now.getHours();
var mins = now.getMinutes();
var secs = now.getSeconds();
var timerVar = "";
timerVar += year +"年"
timerVar +=((month <10)?"0" + month : month) + "月";
timerVar += date + "日"
timerVar += ((hours<12) ? hours:hours - 12) + "点";
timerVar +=((mins < 10)?":0":":") + mins + "分";
timerVar +=((secs < 10)?":0":":") + secs + "秒";
document.clock.face.value = timerVar;
window.status= clock.face.value;
timerID = setTimeout("showTimer()",1000);//Here
timerRunning = true;
}
function startClock(){
showTimer();
}
</script>
</head>
<body onLoad="startClock()">
<p align="center"><big><span style="background-color:rgb(45,45,45)">
<font face="宋体">时钟</font>
</span></big></p>
<table border="0" cellspacing="0" cellpadding="0">
<tr><td width="100%">
<form NAME="clock">
<input Type="rext" NAME="face" size="30" style="background-color:rgb(100,100,60)">
</form>
</td>
</tr>
</table>
</body>
</html>
<head>
<title>clock</title>
<script language="javascript">
var timerID = null; //Here
var timerRunning = false;
function stopClock() {
if (timerRunning)
{
clearTimerout(timerID);
timerRunning = false;
document.clock.face.value = "";
}
}
function showTimer(){
//timerID =setTimeout("showTimer()",1000); //Here
var now =new Date();
var year= now.getYear();
var month = now.getMonth() + 1 ;
var date = now.getDate();
var hours = now.getHours();
var mins = now.getMinutes();
var secs = now.getSeconds();
var timerVar = "";
timerVar += year +"年"
timerVar +=((month <10)?"0" + month : month) + "月";
timerVar += date + "日"
timerVar += ((hours<12) ? hours:hours - 12) + "点";
timerVar +=((mins < 10)?":0":":") + mins + "分";
timerVar +=((secs < 10)?":0":":") + secs + "秒";
document.clock.face.value = timerVar;
window.status= clock.face.value;
timerID = setTimeout("showTimer()",1000);//Here
timerRunning = true;
}
function startClock(){
showTimer();
}
</script>
</head>
<body onLoad="startClock()">
<p align="center"><big><span style="background-color:rgb(45,45,45)">
<font face="宋体">时钟</font>
</span></big></p>
<table border="0" cellspacing="0" cellpadding="0">
<tr><td width="100%">
<form NAME="clock">
<input Type="rext" NAME="face" size="30" style="background-color:rgb(100,100,60)">
</form>
</td>
</tr>
</table>
</body>
</html>
解决方案 »
- 正则匹配小数,这样子为什么是不对的呢?
- 想做个网站,有没有办法调用谷歌的搜索结果并对其进行编辑?
- 有实现这个功能的Jquery的插件吗?
- 求一正则
- window.createPopup() 的问题
- jquery.form.js表单插件问题
- 各位帮帮忙,谁有200409,2004-09-03 11:20:35 日历控件,谢谢!
- 给hidden的VALUE属性附值,最大能附多少KB??
- 模板上不能写中文
- 请问用CFX+spring+hibernate 搭框架需要用到哪些包
- 怎么在一个表单每个按狃提交后附带一个参数或者提交后网页转向?谢谢
- 怎樣把<textarea >種的value寫到SQL Server上
timerID = setTimeout("showTime()",1000);
应为
timerID = setTimeout("showTimer()",1000);
其实这一行去掉就可以
与第16行是重的
他已在修改的那一行加了注释!
timerID = setTimeout("showTimer()",1000);//Here"showTime()"
----->>>>>
"showTimer()"