Scissors, stone cloth.

Source: Internet
Author: User
Tip: You can modify some of the code before running

<ptml> <pead> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "> <title> scissors Stone cloth </title> </pead> <body> <script language=" JavaScript " ; function PlayGame (choice) {with (document.game) {comp = Math.Round ((Math.random () * 2) + 1); var choicename; if (comp = = 1) choicename = "Rock"; if (comp = = 2) Choicename = "paper"; if (comp = = 3) Choicename = "scissors"; Msg.value = ' The computer chose ' + Choicename + '; '; Switch (choice) {case 1:if (comp = = 1) {draw.value++; Msg.value + = ' It is a draw. '; if (comp = = 2) {loss.value++; Msg.value + = ' you lost! '; Break if (comp = = 3) {win.value++; msg.value = ' You won! '; Break Case 2:if (Comp = = 1) {win.value++; Msg.value + = ' you won! '; Break } if (comp = = 2) {draw.value++; msg.value = ' It is a draw. '; if (comp = = 3) {loss.value++; msg.value = ' You lost! '; Break }Case 3:if (Comp = = 1) {loss.value++; Msg.value + = ' you lost! '; Break if (comp = = 2) {win.value++; msg.value = ' You won! '; Break } if (comp = = 3) {draw.value++; msg.value = ' It is a draw. '; } Msg.value + = ' Go again! '; } </script> <center> <form name=game> <table border=1 cellpadding=5> <tr> <td align=ce nter>user:</td> <td align=center> </td> <td align=center> </td> <td align=center > </td> </tr> <tr> <td colspan=4 align=center><input type=text name=msg size=45></ td> </tr> <tr> <td colspan=4 align=center> <input type=text name=win readonly value= "0" size= "2" & Gt Wins <input type=text name=loss readonly value= ' 0 "size=" 2 "> Losses <input type=text name=draw readonly value=" 0 " Size= "2" > Draws </td> </tr> </table> </form> </center> </body> </ptml>
Tip: You can modify some of the code before running

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.