复制代码
案例4:时间调用
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
var o=document.getElementById('box');
function showTime(){
//获取年,月,日
var date = new Date;
var year=date.getFullYear();
var month=date.getMonth()+1;
var day=date.getDate();
//获取时,分,秒
var hour=date.getHours();
var minute=date.getMinutes();
var second=date.getSeconds();