JSFiddle - React, Tailwind, and code Playground

by bohdantheone

HTML

<html>
<head>
<script>
var result;
function changeResult(result){
  if(isNaN(result)===true)
  alert('Помилка під час операції з числами, введіть інше число'); 
    else 
      document.getElementById('to').value = result;
}

function calculateForm(){
  var d=document.getElementById('from').value;
    var a = Math.sqrt(Math.sin(3.2*Math.pow(d,2)));
    var b = Math.abs(Math.log(Math.pow(d,2))+Math.sqrt(Math.abs(d+3)));
    result = a/b;    
  changeResult(result);
}
</script>
</head>
<body>
<!-- форма -->
<form name="calculator" method="post" >
<input type="text" name="number" id="from" size=20 value="25">
<input type="text" name="number" id="to" size=20 value="0">
</form>
<input type="button" onClick="calculateForm();" value="Розрахувати">
</body>
</html>