1 <head>
2 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3 <title>无标题文档</title
4 ><script type="text/javascript">
5 function rd(a)
6 {
7 var c;
8 c=Math.floor(Math.random()*3)+1;
9 a=parseInt(a);
10 change(a,"q1");
11 change(c,"q2");
12 var dz=parseInt(document.getElementById("dzlist").value);
13 sydz=document.getElementById("sydz");
14 var b=parseInt(sydz.value);
15 var result=document.getElementById("r1");
16 if(a==c)
17 {
18 result.value=" 打成平手! ";
19 }
20 else if(c-a==1||a-c==2)
21 {
22 result.value=" 恭喜你赢了! ";
23 sydz.value=b+dz+"万";
24 }
25 else
26 {
27 result.value=" 不好意思你输了! ";
28 sydz.value=b-dz+"万";
29 }
30 }
31 function change(a,b)
32 {
33 var c=document.getElementById(b);
34 switch(a)
35 {
36 case 1: c.src="images/shitou.png";
37 break;
38 case 2: c.src="images/jiandao.png";
39 break;
40 case 3: c.src="images/bu.png";
41 break;
42 default :break;
43 }
44 return;
45 }
46 </script>
47
48 </head>
49
50 <body >
51 <div id="aa" align="center">
52 <table>
53 <tr align="center">
54 <td>你的猜拳区</td><td><input type="text" id="r1"/></td><td>电脑猜拳区</td>
55 </tr>
56 <tr>
57 <td><img id="q1" src="images/shitou.png" /></td>
58 <td></td>
59 <td><img id="q2" src="images/shitou.png" /></td>
60 </tr>
61 <tr>
62 <td colspan="3" align="center">你要下的赌注:<select id="dzlist" >
63 <option selected="selected">100万</option>
64 <option >200万</option>
65 <option >500万</option>
66 </select></td>
67 </tr>
68 <tr align="center">
69 <td colspan="3">你剩余的赌注<input type="text" value="10000万" id="sydz"/></td>
70 </tr>
71 <tr align="center">
72 <td colspan="3" ><input type="button" value=" 石头 " onclick="rd(‘1‘)">
73 <input type="button" value=" 剪刀 " onclick="rd(‘2‘)">
74 <input type="button" value=" 布 " onclick="rd(‘3‘)"></td>
75 </tr>
76 </table>
77 </div>
78
79 </body>
时间: 2024-10-07 09:12:49