topical media & game development

talk show tell print

lib-js-math-calculator-celsius.htm / htm



  
  <!-- ONE STEP TO INSTALL FAHRENHEIT TO CEL. CONVERTER:
  
    1.  Copy the coding into the BODY of your HTML document  -->
  
  <!-- STEP ONE: Paste this code into the BODY of your HTML document  -->
  
  <BODY>
  
  <SCRIPT LANGUAGE="JavaScript">
  
  <!-- This script and many more are available free online at -->
  
  <!-- The JavaScript Source!! http://javascript.internet.com -->
  
  <!-- Original:  Lav Mir -->
  
  <!-- Begin
  
  <!-- ;
  
  var themethod= prompt("Please enter celsius to fahrenheit or fahrenheit to celsius", "Not case sensitive")
  
  var thenewmethod= themethod.toLowerCase()
  
  function f2c(fahrenheit1)
  
  {
  
  var answer ;
  
  celsius1= 5/9 * (fahrenheit1 - 32)  
  
  return ;
  
  }
  
  function c2f(celsius2)
  
  {
  
  var answer ;
  
  var fahrenheit2 ; 
  
  fahrenheit2= 9/5 * celsius2 + 32
  
  return fahrenheit2 ;
  
  }
  
  switch (thenewmethod)
  
  {
  
  case "fahrenheit to celsius":
  
  var thefahrenheit= prompt("Please enter the degrees in fahrenheit", " ") ; 
  
  f2c(thefahrenheit);
  
  answer= celsius1 ;
  
  alert(thefahrenheit + "  is " + answer)
  
  break;
  
  case "celsius to fahrenheit":
  
  var thecelsius= prompt("Please enter the degrees in celsius", " ")
  
  var result= c2f(thecelsius);
  
  alert(+ thecelsius + " is " + result) ; 
  
  break;
  
  default:
  
  document.write("Please reload the page as there was an error")
  
  break;
  
  }
  
  //  End -->
  
  </script>
  
  <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.40 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.