(编辑:jimmy 日期: 2024/11/16 浏览:2)
本文实例为大家分享了JS实现简单日历特效的具体代码,供大家参考,具体内容如下
知识点
1.引入我的工具包
2.运用JavaScript内置对象 Date
运行效果
代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> *{ margin: 0; padding: 0; } #box{ width: 250px; height: 300px; background-color: orangered; margin: 100px auto; padding: 30px; } #box_top{ font-size: 22px; color: #fff; margin-bottom: 40px; display: flex; justify-content: space-around; } #box_bottom{ width: 90%; height: 70%; margin: 0 auto; background-color: orange; font-size: 50px; color:#fff; display: flex; justify-content: center; align-items: center; } </style> </head> <body> <div id="box"> <div id="box_top"> <span id="year"></span> <span>年</span> <span id="month"></span> <span>月</span> <span id="day"></span> <span>日</span> <span id="week"></span> </div> <div id="box_bottom"> <span id="hour"></span> <span>:</span> <span id="minute"></span> <span>:</span> <span id="second"></span> </div> </div> <script src="/UploadFiles/2021-04-02/MyTools.js">以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。