爆肝半小时,我做了个免费的面试刷题网
我正在参加「创意开发 投稿大赛」详情请看:掘金创意开发大赛来了!
温馨提示:暑假已过半
暑假走过半程,孩子们的假期状态如何?假期计划进行到哪一步了?该完成的事情都完成了吗?是否有落下的任务还拖着没有做?接下来的一个月又该如何度过?
现在的孩子太卷了,为了让孩子更好地适应开学的节奏,所以我决定做一个设计非常人性的刷题网;适用于小学,初中,高中,大学。
有了这个想法后,我就踏上了一条爆肝的不归路,还找了很多小伙伴一起探讨内容。真的花了很多人力、财力、精力,甚至七夕都在拉着女朋友跟我一起搞代码。
终于,在半个小时后的现在,我的网站 刷题鸭 正式上线了!
感兴趣的可以看看 点击跳转
浅看一下页面
代码分析
html页面 没什么好说的
<div class="box">
<div class="top">
<h2>每天一遍,智商再见</h1>
</div>
<div class="bottom">
<h1>如题</h1>
<span> <b>273</b> * 0 = </span> <input type="text">
<br>
<button>确定</button>
</div>
<audio src="/nb.mp3"></audio>
<audio src="/sb.mp3"></audio>
</div>
css样式 简简单单看看
* {
margin: 0;
padding: 0;
}
.box {
margin: 100px auto;
width: 300px;
height: 600px;
border: 1px solid;
}
.box .top {
width: 100%;
height: 50px;
background-color: rgb(54, 163, 235);
}
.box .top h2 {
line-height: 50px;
color: white;
}
.box .bottom {
text-align: center;
}
.box .bottom span {
font-weight: 600;
}
.box .bottom h1 {
padding: 30px;
margin-top: 100px;
}
.box .bottom input {
width: 50px;
border: transparent;
border-bottom: 1px solid;
outline: 0px;
margin-bottom: 20px;
}
.box .bottom button {
width: 60px;
height: 30px;
}
js代码
获取要用的元素
let btn = document.querySelector('button');
let ipt = document.querySelector('input');
let audio = document.querySelectorAll('audio');
let b = document.querySelector('b');
创建一个随机数
let ran = Math.floor(Math.random() * 1000);
将随机数赋值
b.innerText = ran
点击判断:点击获取input的数值,如果=0,播放音频1;否则播放音频2,然后刷新页面
btn.onclick = function () {
if (ipt.value == 0) {
audio[0].play()
} else {
audio[1].play()
setTimeout(() => {
location.reload()
}, 900);
}
}
代码展示
这个设计非常仁杏化的程序就做好啦
代码要自己先看懂哦!
拿走不谢!~~~~~
点个赞再走呗,下次见喽!