效果图:
输入1是剪刀,2是石头,3是布。
输入完之后,会弹出一个弹窗,显示你是赢了还是输了。
代码非常简单,唯一难点的地方,就在js里面,里面有一丢丢难度的地方,会在注释里面解释。
下面上代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#screen1{
position: absolute;
top: 100px;
left:200px;
width: 400px;
height: 300px;
border: 2px solid gainsboro;
border-radius: 5px;
background-color: transparent;
float: left;
}
#screen1:after{
clear: both;
}
#screen2{
position: absolute;
top: 100px;
left:650px;
width: 400px;
height: 300px;
border: 2px solid gainsboro;
border-radius: 5px;
background-color: transparent;
float: right;
}
#screen2:after{
clear: both;
}
#screen3{
position: absolute;
top: 450px;
right:600px;
width: 400px;
height: 400px;
border: 2px solid gainsboro;
border-radius: 5px;
background-color: transparent;
float: right;
}
#screen3:after{
clear: both;
}
#code{
position: absolute;
top: 200px;
right: 100px;
width: 150px;
height: 150px;
background-color: transparent;
border: 3px solid dodgerblue;
border-radius: 5px;