C to F to C
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Functions</h1>
<p>This example calls a function which performs a calculation, and returns the result:</p>
<input type=input id="p1">
<input type=button onclick="myFunction()" value="C to F">
<input type=button onclick="yourFunction()" value="F to C">
<p id="demo"></p>
<script>
function myFunction() {
var p1= document.getElementById("p1").value;
document.getElementById("demo").innerHTML = p1*1.8+32;
}
function yourFunction() {
var p1= document.getElementById("p1").value;
document.getElementById("demo").innerHTML = (p1-32)*5/9;
}
</script>
</body>
</html>