topical media & game development

talk show tell print

game-javascript-casual-fortune-teller-game.htm / htm



  
  <!-- TWO STEPS TO INSTALL FORTUNE TELLER:
  
    1.  Copy the coding into the HEAD of your HTML document
    2.  Add the last code into the BODY of your HTML document  -->
  
  <!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->
  
  <HEAD>
  
  <SCRIPT LANGUAGE="JavaScript">
  <!-- Original:  Ronnie T. Moore -->
  <!-- Web Site:  The JavaScript Source -->
  <!-- Based on code by: Michael Carpenter -->
  <!-- URL:  http://www.michaelcarpenter.net -->
  
  <!-- This script and many more are available free online at -->
  <!-- The JavaScript Source!! http://javascript.internet.com -->
  
  <!-- Begin
  var answers = new Array(
  "Without a doubt", 
  "Yes!", 
  "Probably so", 
  "It isn't likely", 
  "it's possible",
  "Absolutely", 
  "Not a chance",
  "Ask again", 
  "No", 
  "I doubt it", 
  "No Way"
  );
  function fortune() {
  num = Math.round( (answers.length - 1) * Math.random());
  return answers[num];
  }
  //  End -->
  </script>
  </HEAD>
  
  <!-- STEP TWO: Copy this code into the BODY of your HTML document  -->
  
  <BODY>
  
  <center>
  <form>
  Your question:  <input type=text name=question size=40>
  <input type=button name=ask value="Ask" onClick="if (this.form.question.value!='') this.form.answer.value = fortune();"><br>
  Your fortune teller says:  <input type=text name=answer size=40>
  </form>
  </center>
  
  <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.27 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.