前段时间女朋友说他需要一个看时间的小东西,我那么爱他!!肯定是满足他了!!等我把写好的网页发过去却分手了。。。。。。。
效果如下,不好看吗?想不懂唉
我们首先新建一个txt文件—>把下面代码写入–>文件的后缀名改为html,就完成绝世时间观看工具
<!DOCTYPE html>
<html>
<head>
<meta charset="BIG5">
<title>時間的流逝 </title>
<script>
//定義一個函數來顯示當前時間
function displayTime(){
var elt =document.getElementById("clock");
var now=new Date();
elt.innerHTML=now.toLocaleTimeString();
setTimeout(displayTime,1000);
}
window.onload=displayTime;
</script>
<style>
#clock{
font:bold 24pt sans;
background:#ddf;
padding:10px;
border:solid black 2px;
border-radius:10px;
}
</style>
</head>
<body>
<h1>Jorya的計時器</h1>
<span id="clock"></span>
</body>
</html>
转载:https://blog.csdn.net/qq_43755954/article/details/105488710
查看评论