免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1731 | 回复: 3
打印 上一主题 下一主题

自写的剪子包袱锤小游戏 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-04-09 00:46 |只看该作者 |正序浏览
<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>";
}

论坛徽章:
0
4 [报告]
发表于 2006-04-09 22:42 |只看该作者
可以放在教科书里

论坛徽章:
0
3 [报告]
发表于 2006-04-09 10:14 |只看该作者
lz 考虑用js写

论坛徽章:
0
2 [报告]
发表于 2006-04-09 10:06 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP