-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjst_game.js
38 lines (37 loc) · 1.06 KB
/
jst_game.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function self(h) {
var jd = document.getElementById("s_jd");
var bu = document.getElementById("s_bu");
var st = document.getElementById("s_st");
var rs=document.getElementById("r_second");
var rr=document.getElementById("r_r");
document.getElementById("r_first").src= h.src;
var radom = Math.random();
if (radom < 0.33) {
rs.src = jd.src;
if(h.id=="s_jd")
{rr.innerHTML = "平手"}
else if(h.id=="s_bu")
{rr.innerHTML = "输了"}
else if(h.id=="s_st"){
rr.innerHTML = "赢了"
}
} else if (radom < 0.66) {
rs.src = bu.src;
if(h.id=="s_jd")
{rr.innerHTML = "赢了"}
else if(h.id=="s_bu")
{rr.innerHTML = "平手"}
else if(h.id=="s_st"){
rr.innerHTML = "输了"
}
} else {
rs.src = st.src;
if(h.id=="s_jd")
{rr.innerHTML = "输了"}
else if(h.id=="s_bu")
{rr.innerHTML = "赢了"}
else if(h.id=="s_st"){
rr.innerHTML = "平手"
}
}
}