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

企业网站建设与管理seo网站诊断流程

企业网站建设与管理,seo网站诊断流程,怎样做 网站的快捷链接,什邡移动网站建设经典回顾倒计时 倒计时的基本布局介绍。 一个内容区域和一个输入区域,内容区域进行划分 直接使用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.hkea.cn/news/590512/

相关文章:

  • 做网站4000-262-263网站排名优化软件有哪些
  • 网站双链接怎么做网络舆情监测平台
  • 企业网站建设制作百度网盘下载app
  • asp做一个简单网站网络营销就是seo正确吗
  • 移动wap站点公司网站设计图
  • 网站策划建设seo搜索排名影响因素主要有
  • 大型商业广场网站建设互联网推广方案怎么写
  • p2vr做的网站上传网络广告策划书范文
  • 2022年大连黄页优化搜索引擎营销
  • 宁波有几个区昭通网站seo
  • 建设企业网站方案网站优化软件哪个好
  • 郑州做网站要搜索引擎最新排名
  • wordpress建好站了打不开首页成都关键词优化排名
  • 京东网站开发需求如何做谷歌优化
  • 微信app开发诊断网站seo现状的方法
  • 做旅行网站网站seo优化多少钱
  • 上海专业网站建设咨询网络销售怎么样
  • 奶茶网页设计图片湖南seo网站多少钱
  • 家里电脑做网站服务器如何建立网址
  • 临西做网站哪里便宜seo专业培训课程
  • 高端网站设计报价表个人网上卖货的平台
  • 广州网站优化推广公司网站优化排名资源
  • 济南网站建设大标网络企业seo服务
  • net域名大网站东莞关键词自动排名
  • 做企业平台的网站怎样进行网络营销吸引顾客
  • 天河网站 建设seo信科分公司谷歌搜索引擎网址
  • 西安网站建设招骋外贸如何推广
  • 网站改版降权武汉seo排名公司
  • 南京哪家公司做企业网站 做得比较好百度seo怎么优化
  • 白云做网站SEO市场营销策略有哪些