topical media & game development

talk show tell print

game-javascript-casual-russian-roulette-game.htm / htm



  
  <!-- ONE STEP TO INSTALL RUSSIAN ROULETTE:
  
    1.  Copy the coding into the BODY of your HTML document  -->
  
  <!-- STEP ONE: Paste this code into the BODY of your HTML document  -->
  
  <BODY>
  
  <!-- This script and many more are available free online at -->
  
  <!-- The JavaScript Source!! http://javascript.internet.com -->
  
  <!-- Original:  JavaScript Kit -->
  
  <!-- Web Site:  http://javascriptkit.com -->
  
  <table border="0" width="350" cellspacing="0" cellpadding="0">
  
    <tr>
  
      <td><img border="0" src="roulette.jpg" width="152" height="216"></td>
  
      <td>
  
  <form name="fire">
  
  Load number of bullets (1-6):<br><input name="bullets" type="text" size=3 value=1><br>
  
  <p>
  
  <input name="message" type="button" value="Play Roulette!" onClick="fireit()">
  
  </p>
  
  </form>
  
  <script>
  
  function fireit(){
  
  var theone=Math.floor(Math.random()*6)
  
  if (theone<=document.fire.bullets.value-1)
  
  alert("Bang. You\'re dead!")
  
  else{
  
  document.fire.message.value="Whew. Got lucky!"
  
  setTimeout("document.fire.message.value='Play Roulette'",500)
  
  }
  
  }
  
  </script>
  
  </td>
  
    </tr>
  
  </table>
  
  <p><center>
  
  <font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
  
  by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
  
  </center><p>
  
  <!-- Script Size:  1.25 KB -->
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.