Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Celcius to Fahrenheit</title>
- <style>
- .converter{
- width: 500px;
- margin: auto;
- font-family: sans-serif;
- }
- label{
- display: block;
- font-weight: bold;
- margin-bottom: 10px;
- margin-top: 10px;
- }
- #celcius{
- width: 300px;
- }
- #fahrenheit{
- width: 300px;
- }
- .button-group{
- margin-top: 20px;
- }
- #reset{
- margin-left: 20px;
- background-color: indigo;
- border-radius: 20px;
- color: ivory;
- border:none;
- outline: none;
- padding: 5px;
- width: 100px;
- }
- #convert{
- background-color: indigo;
- border-radius: 20px;
- color: ivory;
- border:none;
- outline: none;
- padding: 5px;
- width: 100px;
- }
- </style>
- </head>
- <body>
- <div class="converter">
- <h2>Celsius to Fahrenheit Converter</h2>
- <form action="" id="newForm">
- <label for="celcius">
- Celcius
- </label>
- <input type="text" id="celcius" name="celcius">
- <label for="fahrenheit">
- Fahrenheit
- </label>
- <input type="text" id="fahrenheit" name="fahrenheit">
- <br>
- <div class="button-group">
- <input type="button" onclick="convertCelciusToFahrenheit();"value="Covert" id="convert">
- <input type="reset" value="Clear" id="reset">
- </div>
- </form>
- </div>
- <script>
- function convertCelciusToFahrenheit(){
- let celcius = document.getElementById("celcius").value;
- let fahrenheit = document.getElementById("fahrenheit");
- let conversion = ((9/5)*celcius) + 32;
- fahrenheit.value=conversion;
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement