Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- function convert(unit){
- if (unit == "C")
- document.getElementById("f").value = document.getElementById("c").value * 1.8 + 32;
- else
- document.getElementById("c").value = (document.getElementById("f").value - 32) * 1.8;
- }
- </script>
- </head>
- <body>
- Celsius:<input id = "c" onkeyup = "convert('C')">
- Fahrenheit:<input id = "f" onkeyup="convert('F')">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement