js简单获取今天日期,星期,此时时间,并自动更新:
1.写入一个<div></div>用来存放页面内容;
2.写入js代码获取此时时间;
3.css代码用来设置页面内容样式;
效果图:
css全部代码:
#today {
width: 600px;
height: 150px;
border-radius: 30px 80px;
margin: 0 auto;
font-size: 20px;
line-height: 150px;
text-align: center;
font-weight: bolder;
color: white;
text-shadow: 1px -5px 5px powderblue;
/* 字体阴影 */
background-color: wheat;
}
html代码段:
<div id="today"></div>
js全部代码:
<script>
var _today = document.getElementById("today");
// 获取对象
function time() {
date