<script type="text/javascript">
var shu = 0;
var jishi = 0;
var jieguo=document.getElementById("jg");
function bian(){
shu = parseInt(Math.random()*3 )+1;
document.getElementById("p").src="img/"+shu+".png";
jishi = window.setTimeout("bian()",200)
}
function iswin(num){
window.clearTimeout(jishi);
if(num == shu){
jieguo.value="平局";
}else if(num==1&&shu==3||num==2&&shu==1||num==3&&shu==2){
jieguo.value="赢了";
}else{
jieguo.value="输了";
}
}
</script>
</head>
<body>
<table align="center">
<tr align="center">
<td><img src="img/1.png"/ width="200" height="250" id="p" /></td>
</tr>
<tr align="center">
<td><input type="button" value="开始" onclick="bian()"/> </td>
</tr>
<tr align="center">
<td>
<input id="dian1" type="button" value="石头" onclick="iswin(2)"/>
<input id="dian2" type="button" value="布" onclick="iswin(3)"/>
<input id="dian3" type="button" value="剪刀" onclick="iswin(1)"/>
</td>
</tr>
<tr>
<td><input id="jg" type="text" /> </td>
</tr>
</table>
小肚腩era
qq_押韵_0
慕婉清5044891
慕粉13727861792
相关分类