想问为什么没有出现时间啊

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>倒计时效果</title>

<style type="text/css">

body{

margin:0;

padding: 0;

}

#div{

width: 600px;

height: 20px;

background: yellow;

border:2px solid black;

margin: 0 auto;

}

</style>

<script type="text/javascript">

window.onload=function(){

showTime();

}

function checkTime(i){

if (i<10) {

i="0"+i;

}

return i;

}

function showTime(){

var mydate=new Data();

var year=mydate.getFullYear();

var month=mydate.getMonth()+1;

var date=mydate.getDate();

var day=mydate.getDay();

var hour=mydate.getHours();

var minute=mydate.getMinutes();

minute=checkTime(minute);

var second=mydate.getSeconds();

second=checkTime(second);

var weekday=["星期日","星期一","星期二","星期三","星期四","星期五"];

document.getElementById("div").innerHTML=year+"年"+month+"月"+date+"日"+weekday[day]+hour+":"+minute+":"+second;

setTimeout(showTime,1000);

}

</script>

</head>


<body>

<div id="div">显示时间的位置</div>

</body>

</html>


初晴ljp
浏览 1244回答 1
1回答

田心枫

你太粗心了var mydate=new Date();应该是Date;不是Data
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript