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

旅游景点网站设计论文公司如何做网络推广营销

旅游景点网站设计论文,公司如何做网络推广营销,适合用struts2做的网站,北京市建设工程交易服务中心网站经典回顾倒计时 倒计时的基本布局介绍。 一个内容区域和一个输入区域,内容区域进行划分 直接使用flex布局会更快一点。 js代码 我们利用一下模块化思想,直接把获得时间这个功能写成一个函数。方便后续的调用 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 lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>倒计时</title><style>* {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>
</head><body><div class="contain"><div class="contain-top">今年是2222年2月22日</div><div class="font">下班倒计时</div><div class="contain-middle-time"><div class="hour">12</div><div class="word">:</div><div class="min">12</div><div class="word">:</div><div class="second">12</div></div><div class="timeout">18 : 30 : 00</div></div><div class="timechoice"><input type="text" placeholder="18:00:00"><button>提交</button></div><script>//加载上边的时间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.yayakq.cn/news/514641/

相关文章:

  • 微信公众号h5网站开发制作网站在本机运行
  • 学院管理网站建设有些网站为什么可以做资讯
  • 网站域名可以自己做吗能在家做的兼职的网站
  • 网站技能培训机构外包小程序公司
  • qq是哪家公司运营的seo网站优化专员
  • 东莞专业微网站建设推广河南省建设工程信息网查询
  • 天远软件网站建设小牛门户网站
  • 罗湖商城网站建设哪家好百度站长工具使用方法
  • 江苏省国家示范校建设专题网站网上如何推广平台
  • 2019年做网站还有机会吗wordpress怎么备份数据库结构
  • 网站的建立过程西安大公司
  • 做网站上传图片一直错误wordpress照片ppt
  • 常熟做网站推广的排名查询
  • 电白手机网站建设公司福州模板建站代理
  • 做网站镜像步骤微信红包封面开放平台
  • 手机建站网wordpress在固定链接设置页面
  • 网站备案名称规定WordPress开网站很慢
  • PPT做的好的有哪些网站如何规划网站栏目
  • 信息技术课做网站网站维护界面设计
  • 网站内套网站代码浙江省网站备案流程
  • 个人建设网站还要备案么校园网站如何管理
  • 免费可商用图片素材网站郑州注册公司费用
  • 光谷 网站建设公司wordpress主题包安装
  • 免费ppt下载网站上海建设厅网站
  • 360网站推广wordpress 访问密码忘记
  • asp做的网站亚丝娜娜本子全彩域名备案 填写网站信息
  • 加盟培训网站建设建设制作外贸网站公司
  • 国外设计网站app有哪些商城网站都有什么功能
  • php下载站源码凡科建站收费价目表
  • 绵阳网站建设哪家好深圳保障性住房申请条件