Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <h2>JavaScript Celcius to Fahrenhet</h2>
- <p>Insert a number into one of the input fields below:</p>
- <script>
- function convert()
- { var c ;
- c = (document.getElementById('cel1').value * 9/5) + 32;
- document.getElementById('fah1').value=Math.round(c);
- }
- function convert1()
- {
- var f;
- f=(document.getElementById('fah1').value - 32)*5/9;
- document.getElementById('cel1').value=Math.round(f);
- }
- </script>
- <form name='myform' method='post'>
- <table>
- <tr><td>celsius:</td><td><input type='text' id='cel1' onkeyup='convert()'/></td></tr>
- <tr><td>Fahrenheit:</td><td><input type='text' id='fah1' onkeyup='convert1()'/></td></tr>
- </table>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement