Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Convert Fahrenheit and Celsius</title>
- </head>
- <script type="text/javascript">
- function ConvertC() {
- var fTempval = parseFloat(document.getElementById("fartemp").value);
- var cTempval = (fTempval - 32) * (5/9);
- document.getElementById("celtemp").value = cTempval;
- if (cTempval >= 0 ) {
- document.getElementById("pic").src = "hottemp.jpg" ; }
- else {document.getElementById("pic").src = "coldtemp.jpg" ; } }
- </script>
- <body>
- <table border=4 cellpadding=3>
- <tr> <td>Farenheit </td>
- <td>Celcius </td>
- <td> <input type="button" value="Enter to Convert to Celcius" onClick="ConvertC()" > </td>
- < /tr>
- <tr>
- <td> <input name="fTemp" id="fartemp" type="text"/> </td>
- <td> <input name="cTemp" id="celtemp" type="text"/> </td>
- <td> <img name="temppic" id="pic" src=" " height="50px" > </td>
- </tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement