- 论坛徽章:
- 0
|
<div align=center><form action='?action=go' method=post>
选择你的类型:
<input type="radio" name="mychoise" value="1" checked>石头
<input type="radio" name="mychoise" value="2">剪子
<input type="radio" name="mychoise" value="3">布
<br/>
<br/>
<br/>
<input type="submit" value="出拳" />
</form>
<hr>
</div>
<?
//made by zairwolf
$arr=array(1=>'石头',2=>'剪子',3=>'布',);
if($action) {
$comschoice=rand(1,3);
if($comschoice-$mychoise==1 || $comschoice-$mychoise==-2) {
$res= "你赢了";
}elseif($comschoice==$mychoise) {
$res= "平局";
}else {
$res= "你输了";
}
echo "<table border=0 align=center cellpadding=4><tr align=left><td>你出的:</td><td>{$arr[$mychoise]} </td></tr><tr align=left><td>电脑出的</td><td name=computer id=computer>出拳中 </td></tr><tr align=left><td>结果</td><td name=res id=res>...</td></tr></table>";
ob_start();
ob_end_flush();
ob_implicit_flush();
for($i = 1; $i <= 300; $i++ ) print(" ");
sleep(1);
echo "<script>document.getElementById('computer').innerHTML=\"{$arr[$comschoice]}\";</script>";
echo "<script>document.getElementById('res').innerHTML='$res';</script>";
} |
|