temperature

temperature - var answerField =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
<?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Temperature Conversion Program --> <!-- Jaime Martin CS 4443 T3/2011 --> < <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Temperature Conversion</title> <script type = "text/javascript"> <!-- function displayC() { var inputField = document.getElementById ( "fField" ); var Fahr = parseFloat(inputField.value); var answerField = document.getElementById ( "answer" ); answerField.value = convertC( Fahr ); } function convertC( Fahr ) { return 5.0 / 9.0 * (Fahr - 32); } function displayF() { var inputField = document.getElementById ( "cField" ); var Cels = parseFloat(inputField.value);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: var answerField = document.getElementById ( "answer" ); answerField.value = convertF( Cels ); } function convertF( Cels ) { return 9.0 / 5.0 * Cels + 32; }--> </script> </head> <body> <form action = ""> <table> <tr><td>Fahrenheit</td> <td><input id = "fField" type = "text" /></td> <td><input type = "button" value = "Convert to Celsius" onclick = "displayC()" /></td> </tr> <tr><td>Celsius</td> <td><input id = "cField" type = "text" /></td> <td><input type = "button" value = "Convert to Fahrenheit" onclick = "displayF()" /></td> </tr> <tr><td>Answer</td> <td><input id = "answer" type = "text" /></td> </table> </form> </body> </html>...
View Full Document

This document was uploaded on 04/22/2011.

Ask a homework question - tutors are online