Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>ROCK! PAPER! SCISSORS!</title>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" type="text/css" href="css/stylesheet.css"/>
  6. <script type="text/javascript" src="javascript/javascript.js"></script>
  7. </head>
  8. <body>
  9. <h1>Rock, Paper, Scissors</h1>
  10.  
  11. <h3>Choose your method of destruction:</h2>
  12. <div>
  13. <img class="image" id="0" src="images/rock.png" alt="ROCK" onclick="pChoice(this)"/>
  14.  
  15. <img class="image" id="1" src="images/paper.png" alt="PAPER" onclick="pChoice(this)"/>
  16.  
  17. <img class="image" id="2" src="images/scissors.png" alt="SCISSORS" onclick="pChoice(this)"/>
  18. </div>
  19.  
  20. <h3>The computer chooses:</h2>
  21.  
  22. <div class="result">
  23. <img id="cpu_image" src="" alt=""/>
  24. <p id="result_text"></p>
  25. </div>
  26.  
  27. <div class="score">
  28. <p><u><b>Score</b></u></p>
  29. <p id="pwin_text">You: </p>
  30. <p id="cwin_text">Computer: </p>
  31. </div>
  32. </body>
  33. </html>
  34.  
  35. if (e.id == cpu_choice)
  36. {
  37. resultText.innerHTML = "It's a Tie!";
  38. setTimeout(reset(e, cpuImage), 2000);
  39. }
  40. else if (((e.id - cpu_choice) + 3) % 3 === 1)
  41. {
  42. resultText.innerHTML = "You Win!";
  43. player_win++;
  44. playerWin.innerHTML = "You: "+player_win;
  45. setTimeout(reset(e, cpuImage), 2000);
  46. }
  47. else
  48. {
  49. resultText.innerHTML = "You Lose!";
  50. cpu_win++;
  51. cpuWin.innerHTML = "Computer: "+cpu_win;
  52. setTimeout(reset(e, cpuImage), 2000);
  53. }
  54. }
  55.  
  56. function reset(e, cpuImage)
  57. {
  58. e.style.border = "3px solid white";
  59. cpuImage.src = "";
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement