📄 clock.jsp
字号:
<html>
<head><title>Clock</title>
<script language="JavaScript">
<!--
var timerID=null;
var timerRunning=false;
function stopclock(){
if(timerRunning)
clearTimeout(timerID);
timerRunning=false;
}
function startclock(){
stopclock()
showclock();
}
function showclock(){
var now=new Date();
var hour = now.getHours();
var minute= now.getMinutes();
var second= now.getSeconds();
var timeValue=""+((hour>12)? hour-12: hour);
timeValue=timeValue+((minute<10)? ":0": ":") + minute;
timeValue=timeValue+((second<10)? ":0": ":") + second;
timeValue=timeValue+((hour>=12)? " P.M": " A.M");
document.clock.face.value = timeValue;
//you could replace the above with this and have
//a clock on the status bar:
//window.status=timeValue;
timerID=setTimeout("showclock()",1000);
timerRunning=true;
}
//end -->
</script>
</head>
Welcome to My HomePage!<p>
<body bgcolor="#ffffff" text="#000000" link="#0000ff"
alink="#008000" vlinnk="8000880" onLoad="startclock()">
<form name="clock" onSubmit="0">
Now time: <input type="text" name="face" size=15 value="">
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -