<html> <head> <link href="css/bootstrap.css" rel="stylesheet"> </head> <body> <div class='col-lg-3'> <div class='well'> <h2> Find a missing angle</h2> <input class='form-control' type='text' id='q' placeholder=' opposite / adjacent'> <br> <input class='form-control' type='text' id='e' placeholder=' adjacent / hypotenuse'> <br> <br> <p> sin <sup> -1 </sup> <input class='btn btn-success' type='button' onClick='aSin()' value='sin'> <input class='btn btn-success' type='button' onClick='aSind()' value='Round'> <br> <p> cos <sup> -1 </sup> <input class='btn btn-info' type='button' onClick='aCos()' value='cos'> <input class='btn btn-info' type='button' onClick='aCosd()' value='Round'> <br> <p> tan <sup> -1 </sup> <input class='btn btn-warning' type='button' onClick='aTan()' value='tan'> <input class='btn btn-warning' type='button' onClick='aTand()' value='Round'> <p id='w'> </p> </div> <script> function toRadians (angle) { return angle * (Math.PI / 180); } function aSin() { var a = document.getElementById('q').value; var c = document.getElementById('e').value; var z = a / c var b = document.getElementById('w').innerHTML = Math.asin(z) * (180 / Math.PI); } function aSind() { var a = document.getElementById('q').value; var c = document.getElementById('e').value; var z = a / c var t = Math.asin(z) * (180 / Math.PI) var b = document.getElementById('w').innerHTML = Math.round(t) + 'º'; } function aCos() { var a = document.getElementById('q').value; var c = document.getElementById('e').value; var z = a / c var b = document.getElementById('w').innerHTML = Math.acos(z) * (180 / Math.PI); } function aCosd() { var a = document.getElementById('q').value; var c = document.getElementById('e').value; var z = a / c var t = Math.acos(z) * (180 / Math.PI) var b = document.getElementById('w').innerHTML = Math.round(t) + 'º'; } function aTan() { var a = document.getElementById('q').value; var c = document.getElementById('e').value; var z = a / c var b = document.getElementById('w').innerHTML = Math.atan(z) * (180 / Math.PI); } function aTand() { var a = document.getElementById('q').value; var c = document.getElementById('e').value; var z = a / c var t = Math.atan(z) * (180 / Math.PI) var b = document.getElementById('w').innerHTML = Math.round(t) + 'º'; } </script> </body> </html>
JavaScript | Finding a missing angle
First of all, don't be an idiot, put this in a directory where bootstrap is available, if you don't know how to, then enjoy a very ugly converter, apart from that, this code is bloody great (probably not, but it is, deal with it)