根据上一篇分享的时钟代码的学习——JS-从简单到复杂的做一个时钟(学习过程),写一个完整的网页数字时钟(有样式的数字时钟),完整代码如下:
<html>
<head>
<meta charset="utf-8">
<title>数字时钟</title>
<style>
@font-face{
font-family:'ZCoolArtFont';
src: url('ZCoolArtFont.ttf')format('truetype');
}
.textSet{ /*文本通用设置*/
font-weight:bold;
}
.box{
width: 600px;
height: 100%;
background-color: #B0C4DE;
margin-left: auto;
margin-right: auto;
border-radius: 15px;
user-select: none;/*Non-prefixed version, currently supported by most modern browsers.无前缀版本,目前大多数现代浏览器都支持*/
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Chrome/Safari/Opera */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explor