学习js也有一段时间了,今天练习一个实现倒计时效果的小例子,自娱自乐。
说着也快到高考了,就先来一个高考倒计时吧!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>高考倒计时</title>
<style type="text/css">
*{margin:0;padding:0;font-family:"微软雅黑";font-size:20px;}
.wrap{background:lightBlue;width:500px;height:60px;margin:40px auto;}
.con{line-height: 60px;text-align: center;}
#show{color:red;font-size:24px;font-weight:bold;padding:0 10px;}
</style>
</head>
<body>
<div class="wrap">
<div class="con">距离高考还剩<span id="show"></span>天</div>
</div>
<script type="text/javascript">
window.οnlοad=function(){
var now = new Date(); //获取当前时间