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

前端 : 用HTML ,CSS ,JS 做一个点名器

1.HTML:

<body><div id = "content"><div id="top"><div id = "name">XAiot2302班点名器</div></div><div id = "center"><div id = "word">你准备好了吗?</div></div><div id = "bottom"><div id="btn_start">开始</div><div id="btn_stop">停止</div><div id = "btn_reset">重置</div></div></div></body>

2.CSS     

<script src="jquery-3.6.0.js"></script><style>*{margin: 0;padding: 0;}html,body{width:100%;height: 100%;}#content{width: 100%;height: 100%;position: relative;}#top{width:100%;height: 100px;/* background-color: aqua; */position: relative;	}#name{font-size: 50px;font-weight: 800;color:brown;position: absolute;top: 50%;margin-top: -25px;left: 40%;top: 100px;}#center{width:100%;height: 100px;/* background-color: blue; */position: relative;	top: 100px;	}#word{font-size: 40px;color: red;position: absolute;top: 50%;margin-top: -25px;left: 50%;margin-left: -50px;}#bottom{width:100%;height: 400px;/* background-color: blue; */position: relative;	top: 130px;	}#btn_start{font-size: 40px;color: white;position: absolute;top: 20%;margin-top: -20px;left: 50%;background-color: red;border-radius: 10px;}#btn_stop{font-size: 40px;color: white;position: absolute;top: 40%;margin-top: -20px;left: 50%;background-color: yellow;border-radius: 10px;}#btn_reset{font-size: 40px;color: white;position: absolute;top: 60%;margin-top: -20px;left: 50%;background-color: skyblue;border-radius: 10px;}</style>

    3.JS

<script type="text/javascript">var nums=["乔凯晨","张晋若","张立","焦鹏祥","郭鑫","景清雷","徐绍平","代卫能","曹科","郭力玮","张彪","刘卓锦"];function suiji(){var num = Math.random()*nums.length;var num = Math.floor(num);var i = nums[num];$("#word").html(i);}var id = 0;$("#btn_start").click(function(){id = setInterval(suiji,80);});$("#btn_stop").click(function(){clearInterval(id);});$("#btn_reset").click(function(){// location.reload();$("#btn_start").html("开始");$("#word").html("你准备好了吗?")});
</script>

效果展示:

http://www.lryc.cn/news/211389.html

相关文章:

  • css:button实现el-radio效果
  • 算法工程师-机器学习-数据科学家面试准备4-ML系统设计
  • git重装后如何连接以前项目
  • 【java学习—十】TreeSet集合(5)
  • JMeter的使用,傻瓜式学习【上】
  • 主定理(一般式)
  • WLAN的组网架构和工作原理
  • 使用OBS Browser+访问华为云OBS存储【Windows】
  • C++总结(3):类的动态内存分配、异常、类型转换运算符
  • 折半搜索(meet in the middle)
  • 【机器学习】loss损失讨论
  • LeetCode 779. 第K个语法符号【递归,找规律,位运算】中等
  • java try throw exception finally 遇上 return break continue造成异常丢失
  • 设计模式——装饰器模式(Decorator Pattern)+ Spring相关源码
  • MATLAB R2018b详细安装教程(附资源)
  • GEE错误——影像加载过程中出现的图层无法展示的解决方案
  • 读图数据库实战笔记03_遍历
  • QT如何检测当前系统是是Windows还是Uninx或Mac?以及是哪个版本?
  • Maven配置阿里云中央仓库settings.xml
  • 由浅入深C系列八:如何高效使用和处理Json格式的数据
  • 多媒体应用设计师 第16章 多媒体应用系统的设计和实现示例
  • golang平滑重启库overseer实现原理
  • 用Python定义一个函数,用递归的方式模拟汉诺塔问题
  • 二手的需求
  • 大厂面试题-JVM为什么使用元空间替换了永久代?
  • 基本微信小程序的驾校宝典系统-驾照考试系统
  • 02、SpringCloud -- Redis和Cookie过期时间刷新功能
  • 【报错】kali安装ngrok报错解决办法(zsh: exec format error: ./ngrok)
  • <学习笔记>从零开始自学Python-之-常用库篇(十三)内置小型数据库shelve
  • Redis快速上手篇七(集群-六台虚拟机)