Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Convert Fahrenheit and Celsius</title>
  5. </head>
  6. <script type="text/javascript">
  7. function ConvertC() {
  8. var fTempval = parseFloat(document.getElementById("fartemp").value);
  9. var cTempval = (fTempval - 32) * (5/9);
  10. document.getElementById("celtemp").value = cTempval;
  11. if (cTempval >= 0 ) {
  12. document.getElementById("pic").src = "hottemp.jpg" ; }
  13. else {document.getElementById("pic").src = "coldtemp.jpg" ; } }
  14. </script>
  15.  
  16. <body>
  17. <table border=4 cellpadding=3>
  18. <tr> <td>Farenheit </td>
  19. <td>Celcius </td>
  20. <td> <input type="button" value="Enter to Convert to Celcius" onClick="ConvertC()" > </td>
  21. < /tr>
  22. <tr>
  23. <td> <input name="fTemp" id="fartemp" type="text"/> </td>
  24. <td> <input name="cTemp" id="celtemp" type="text"/> </td>
  25. <td> <img name="temppic" id="pic" src=" " height="50px" > </td>
  26. </tr>
  27. </table>
  28. </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement