首页 技术 正文
技术 2022年11月14日
0 收藏 806 点赞 3,349 浏览 1479 个字
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Last Work</title>
<style type="text/css">
#gif {
width: 150px;
height: 150px;
background-color: #CCC;
background-size: 100% 100%;
}
.setques {
background-image: url(gif/lookfarward.gif);
}
.right {
background-image: url(gif/happy.gif);
}
.wrong {
background-image: url(gif/babyAngry.gif);
}
table, td {
border: solid 1px grey;
}
</style>
</head>
<body>
<div id="gif" class="setques"></div>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>运算次数:</td>
<td id="count">0</td>
</tr>
<tr>
<td>正确次数:</td>
<td id="rightcnt">0</td>
</tr>
<tr>
<td>错误次数:</td>
<td id="wrongcnt">0</td>
</tr>
</table>
<br/>
<input name="FirstNum" type="text" id="FirstNum" readonly>
+
<input name="SecondNum" type="text" id="SecondNum" readonly>
=
<input type="text" name="SumNum" id="SumNum">
<br/>
<br/>
<button id="SetQues">随机出题</button>
 
<button id="Veri">验证</button>
<script src="jquery-3.4.0.min.js"></script>
<script type="text/javascript">
$(function(){
var count=0;
var rightcnt=0;
var wrongcnt=0;
var c;
$("#SetQues").click(function(){
var a=Math.floor((Math.random()*100)+1);
var b=Math.floor((Math.random()*100)+1);
$("#FirstNum").val(a);
$("#SecondNum").val(b);
c=a+b;
count=count+1;
$("#count").text(count)
});
$("#Veri").click(function(){
var sum=$("#SumNum").val();
s=parseInt(sum);
if(s==c)
{
$("#gif").removeClass();
$("#gif").addClass("right");
rightcnt=rightcnt+1;
$("#rightcnt").text(wrongcnt);
}
else{
$("#gif").removeClass();
$("#gif").addClass("wrong");
wrongcnt=wrongcnt+1;
$("#wrongcnt").text(wrongcnt);
}
});
});
</script>
</body>
</html>
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,487
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,903
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,736
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,486
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,126
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,287