石头剪子布1.asp

来自「ASP 网页数据库短训教程源码」· ASP 代码 · 共 52 行

ASP
52
字号
<%
player=request("choice")
if player=1 or player=2 or player=3 then
  select case player
    case 1
      mychoice="石头"
    case 2
      mychoice="剪子"
    case 3
      mychoice="布"
  end select
  randomize
  Computer=int(rnd*3)+1
  select case Computer
    case 1
      choice="石头"
    case 2
      choice="剪子"
    case 3
      choice="布"
  end select
  if player-Computer=0 then
    pp="平手!"
  elseif player-Computer=-1 or player-Computer=2 then
    pp="恭喜你,你赢了!"
  else
    pp="这次电脑赢了!"
  end if
end if
%>
<html>
  <title>石头、剪子、布小游戏</title>
  <body>
    <Center>
    <table border=1 align=center >
      <COL span=2 width=100>
      <tr align=center><td>玩家<td>电脑
      <tr align=center><td><%=mychoice%><td><%=choice%></tr>
      <tr align=center><td colspan=2><%=pp%></tr>
    </table>
    <hr>
    <form action=石头剪子布1.asp method=post name=f1>请选择:
      <input type=radio name=choice value=1>石头
      <input type=radio name=choice value=2>剪子
      <input type=radio name=choice value=3>布<p>
      <script for=choice event=onclick language=vbscript>
        f1.submit
      </script>
    </form>
  </body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?