topical media & game development

talk show tell print

basic-javascript-03-ch3-examp1.htm / htm



  <html>
  <body>
  
  <script language="JavaScript" type="text/javascript">
  
  var degFahren = Number(prompt("Enter the degrees Fahrenheit",32));
  var degCent;
  
  degCent = 5/9 * (degFahren - 32);
  
  document.write(degFahren + "\xB0 Fahrenheit is " + degCent +
     "\xB0 centigrade<BR>");
  
  if (degCent < 0)
  {
     document.write("That's below the freezing point of water");
  }
  
  if (degCent == 100)
     document.write("That's the boiling point of water");
  
  </script>
  
  </body>
  </html>
  


(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.