Javascript example

HTML

<h1 id="title">Apparent magnitude calculator</h1>
<h4>(Use radians and decimals only, not degrees or fractions.)</h4>
<input type="text" id="phase"  placeholder = "Enter phase angle"/>
<input type="submit" id="byBtn" value="Go!" onclick="change()"/>

JavaScript

function change(){

    var phaseAngle = document.getElementById('phase').value;
    console.log(phaseAngle);
    var phaseIntegral = (2/3)*((1-(phaseAngle/Math.PI))*Math.cos(phaseAngle) + (1/Math.PI)*Math.sin(phaseAngle));
    var magnitude = 0.25 + 2.5*Math.log10((0.00257*0.00257)/phaseIntegral);
   
   var title = document.getElementById('title');
   title.innerHTML = magnitude;
}