时间涵数的练习

Original 2019-02-15 23:35:34 249
abstract:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>日历</title> <style type="text/css"> div{width: 600px;height
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>日历</title>
<style type="text/css">
div{width: 600px;height: 100px;font-size: 20px;color:red;margin: 0 auto;margin-top: 300px;background: pink;line-height: 100px;text-align: center;}
</style>
</head>
<body>
<div>今天的日期是:<span id='pp'></span></div>

<script type="text/javascript">

var mydate = new Date();
year = mydate.getFullYear();
var month = new Array(12);
month[0] = '1月';
month[1] = '2月';
month[2] = '3月';
month[3] = '4月';
month[4] = '5月';
month[5] = '6月';
month[6] = '7月';
month[7] = '8月';
month[8] = '9月';
month[9] = '10月';
month[10] = '11月';
month[11] = '12月';
mon = month[mydate.getMonth()];
day = mydate.getDate();
hou = mydate.getHours();
min = mydate.getMinutes();
sec = mydate.getSeconds();
document.getElementById('pp').innerHTML=year+'年'+mon+day+'日'+hou+'时'+min+'分'+sec+'秒';

</script>


</body>
</html>


Correcting teacher:查无此人Correction time:2019-02-16 09:03:20
Teacher's summary:完成的不错,日期时间函数,多用在弹出时间选择框。比如买机票,每天的价格不一样。多练习,继续加油。

Release Notes

Popular Entries