Reputation: 9
I'm need a HTML/php form on a webpage that solves the following formula, without refreshing the page. I'm struggling with how best to go about it and the code needed to accomplish the task.
The formula needed would be as follows:
100 / ((X * 2)+3) =Y
X
being input into an input box by the user, or selected from a drop down.
Y
being the result displayed, rounded down, with no decimal places, either worked out live upon input/selection or displayed upon a button press.
Is there anyone out there who can help me?
Upvotes: 0
Views: 400
Reputation: 6394
You won't need PHP for this, plain javascript or jQuery will do.
I've created a quick JSFiddle for you.
$('#btnCalc').click(function(e)
{
var num = $('#txtNo').val();
var result = Math.floor(100 / ((num * 2)+3));
$('#result').html('Value is ' + result);
});
Upvotes: 1