当前位置: 首页 > news >正文

网站建设与维护要用到代码吗蛋糕店网站开发策划书

网站建设与维护要用到代码吗,蛋糕店网站开发策划书,杭州网站建设seo优化,什么网站做推广农产品比较好经典回顾倒计时 倒计时的基本布局介绍。 一个内容区域和一个输入区域#xff0c;内容区域进行划分 直接使用flex布局会更快一点。 js代码 我们利用一下模块化思想#xff0c;直接把获得时间这个功能写成一个函数。方便后续的调用 function getTime() {const date new Date…经典回顾倒计时 倒计时的基本布局介绍。 一个内容区域和一个输入区域内容区域进行划分 直接使用flex布局会更快一点。 js代码 我们利用一下模块化思想直接把获得时间这个功能写成一个函数。方便后续的调用 function getTime() {const date new Date()return 今年是${date.getFullYear()}年${date.getMonth()1}月${date.getDate()}日}document.querySelector(.contain-top).innerHTML getTime()然后将输入框中的事件给加载进去注意格式的划分。使用基本的时间算法 const input document.querySelector(input)function dateChat() {const nowdate new Date()let enddate new Date()let time 0const date1 new Date()enddate new Date(${date1.getFullYear()}-${date1.getMonth()1}-${date1.getDate()} ${input.value})time (enddate - nowdate) / 1000let h parseInt(time / 60 / 60 % 24)h h 10 ? 0 h : h let m parseInt(time / 60 % 60)m m 10 ? 0 m : m let s parseInt(time % 60)s s 10 ? 0 s : sdocument.querySelector(.hour).innerHTML hdocument.querySelector(.min).innerHTML mdocument.querySelector(.second).innerHTML s}设置回车监听和按钮监听 input.addEventListener(keyup, function (e) {if (e.key Enter) {if (input.value.length 8) {alert(输入有误)} else {document.querySelector(.timeout).innerHTML input.valuedateChat()setInterval(dateChat, 1000)}}})const button document.querySelector(button)button.addEventListener(click, function () {if (input.value.length 8) {alert(输入有误)} else {document.querySelector(.timeout).innerHTML input.valuedateChat()setInterval(dateChat, 1000)}})完整代码 !DOCTYPE html html langenheadmeta charsetUTF-8meta nameviewport contentwidthdevice-width, initial-scale1.0title倒计时/titlestyle* {padding: 0;margin: 0;box-sizing: border-box;}.contain {width: 300px;height: 300px;background-color: rgb(174, 10, 42);margin: 0 auto;}.contain-top {text-align: center;color: white;padding-top: 20px;margin-bottom: 20px;}.font {text-align: center;color: white;font-size: 25px;}.contain-middle-time {display: flex;justify-content: center;}.contain-middle-time div {text-align: center;margin-top: 40px;width: 40px;line-height: 40px;height: 40px;color: white;background-color: rgb(50, 44, 44);border-radius: 5px;}.contain-middle-time .word {width: 20px;height: 20px;color: white;background-color: rgb(174, 10, 42);}.timeout {margin-top: 60px;font-size: 20px;color: white;text-align: center;}.timeout::after {content: 下课;}.timechoice {margin-top: 10px;text-align: center;}input {outline: none;text-align: center;width: 100px;height: 20px;border: 1px solid black;border-radius: 3px;}button {background-color: white;height: 20px;border: none;color: black;border-radius: 2px;}button:active {color: red;}/style /headbodydiv classcontaindiv classcontain-top今年是2222年2月22日/divdiv classfont下班倒计时/divdiv classcontain-middle-timediv classhour12/divdiv classword:/divdiv classmin12/divdiv classword:/divdiv classsecond12/div/divdiv classtimeout18 : 30 : 00/div/divdiv classtimechoiceinput typetext placeholder18:00:00button提交/button/divscript//加载上边的时间function getTime() {const date new Date()return 今年是${date.getFullYear()}年${date.getMonth()1}月${date.getDate()}日}document.querySelector(.contain-top).innerHTML getTime()// 加载定义的下课时间const input document.querySelector(input)function dateChat() {const nowdate new Date()let enddate new Date()let time 0const date1 new Date()enddate new Date(${date1.getFullYear()}-${date1.getMonth()1}-${date1.getDate()} ${input.value})time (enddate - nowdate) / 1000let h parseInt(time / 60 / 60 % 24)h h 10 ? 0 h : h let m parseInt(time / 60 % 60)m m 10 ? 0 m : m let s parseInt(time % 60)s s 10 ? 0 s : sdocument.querySelector(.hour).innerHTML hdocument.querySelector(.min).innerHTML mdocument.querySelector(.second).innerHTML s}input.addEventListener(keyup, function (e) {if (e.key Enter) {if (input.value.length 8) {alert(输入有误)} else {document.querySelector(.timeout).innerHTML input.valuedateChat()setInterval(dateChat, 1000)}}})const button document.querySelector(button)button.addEventListener(click, function () {if (input.value.length 8) {alert(输入有误)} else {document.querySelector(.timeout).innerHTML input.valuedateChat()setInterval(dateChat, 1000)}})// 倒计时模块/script /body/html
http://www.hkea.cn/news/14516290/

相关文章:

  • 网站和app开发网站建设行情
  • 注册网站授权书怎么写制作链接的app的软件有哪些
  • html5的篮球网站开发中国建设工程项目网
  • 网站建设一般要提供什么内容wordpress数据统计插件
  • 卡密网站建设海西州商城网站建设
  • 做外贸进国外网站网站设计公司 杭州
  • 上饶哪里做网站超级外链吧外链代发
  • 站规划在网站建设中的作用wordpress外链图片备份
  • 织梦做的网站怎么传到网上秦皇岛建设公司
  • 东南亚做网站 什么语言第18讲:商品模型 织梦网站系统 dedecms 教学课件
  • 做婚恋网站沈阳专业做网站开发公司
  • 江门网站建设方案应用公园app在线平台
  • 网站建设基础心得更改wordpress程序站点网址
  • 桂林北站停车场收费标准wordpress国外主题慢
  • 房产网站开发公司青岛网站制作百家号
  • 长沙长沙建设网站WordPress首页怎么打开
  • 做诚信通谁给做网站使用rem布局的网站
  • 学用mvc做网站微网站开发框架
  • 国有企业投资建设项目苏州百度首页优化
  • 搭建网站要不要给域名对方公司介绍模板免费
  • 门户网站营销特点电脑培训班速成班附近
  • 建设银行网站表单清理云南 房地产网站建设
  • 建网站郑州wordpress防止机器人注册
  • 网站后台程序下载电子商务网站建设对毕业设计
  • 大型网站建设机构wordpress lens
  • 寿光建设银行光明路网站网站建设品牌公司推荐
  • 沧州网站建设制作可信网站的认证
  • 电子产品在哪些网站做调研渝东建设工程造价信息网
  • 电子商城网站开发价格WordPress下拉菜单栏
  • 河南瑞达建设工程有限公司网站windows优化大师提供的