# Need input formula for website I am designing

I am in the middle of designing a website and I am pretty new at it. The guy I am designing the website for wants me to make input fields that calculate data that is entered into them. There are 3 formulas that I need to make.
a=b*.262c
c=a/(b
.262)
b=a/(c*.262)

They are the same formula just solving for different variables. Any help would be awesome!

i don’t completely understand your question but you should take a look at javascript functions
like:

``````
function product(first,second)
{
return first*second;
}

product(5,9) // gives 45 (5*9)

``````

this is the code similar to what I am looking for:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<title></title>
<script type=“text/javascript”>
lengthObj = document.getElementById(‘txtLength’);
girthObj = document.getElementById(‘txtGirth’);
weightObj = document.getElementById(‘tdWeight’);
document.getElementById(‘btnReset’).onclick = resetInputs;
document.getElementById(‘btnCalc’).onclick = calcWeight;
}
function resetInputs() {
lengthObj.value = ‘’;
girthObj.value = ‘’;
weightObj.innerHTML = ‘’;
}
function calcWeight() {
var length = new Number(lengthObj.value);
var girth = new Number(girthObj.value);
weightObj.innerHTML = ‘’;
if(isNaN(length) || isNaN(girth)) {
return;
}
weightObj.innerHTML = length*Math.pow(girth,2)/800;
}
</script>
<body>
<table>
<tr>
<td><label for=“txtLength”>Length (inches)</label></td>
<td><input type=“text” id=“txtLength” /></td>
</tr>
<tr>
<td><label for=“txtGirth”>Girth (inches)</label></td>
<td><input type=“text” id=“txtGirth” /></td>
</tr>
<tr>
<td>SFM</td>
<td id=“tdWeight”></td>
</tr>
<tr>
<td></td>
<td><button id=“btnReset”>Reset</button><button id=“btnCalc”>Calculate</button></td>
</tr>
</table>
</body>
</html>

the problem is that I don’t understand the functions so I can’t really edit it.

ok…I have been messing around with it a little bit more and I got the first equation to work, but the other 2 don’t work now here is my code so far:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<title></title>
<script type=“text/javascript”>
DObj = document.getElementById(‘txtD’);
RPMObj = document.getElementById(‘txtRPM’);
SFMObj = document.getElementById(‘tdSFM’);
document.getElementById(‘btnReset’).onclick = resetInputs;
document.getElementById(‘btnCalc’).onclick = calcSFM;
}
function resetInputs() {
DObj.value = ‘’;
RPMObj.value = ‘’;
SFMObj.innerHTML = ‘’;
}
function calcSFM() {
var D = new Number(DObj.value);
var RPM = new Number(RPMObj.value);
SFMObj.innerHTML = ‘’;
if(isNaN(D) || isNaN(RPM)) {
return;
}
SFMObj.innerHTML = D0.262RPM;

``````            SFM1Obj = document.getElementById('txtSFM1');
D1Obj = document.getElementById('txtD1');
RPM1Obj = document.getElementById('tdRPM1');
document.getElementById('btnReset1').onclick = resetInputs;
document.getElementById('btnCalc1').onclick = calcRPM1;
}
function resetInputs() {
SFM1Obj.value = '';
D1Obj.value = '';
RPM1Obj.innerHTML = '';
}
function calcSFM() {
var D = new Number(SFM1Obj.value);
var RPM = new Number(D1Obj.value);
RPM1Obj.innerHTML = '';
if(isNaN(SFM1) || isNaN(D1)) {
return;
}
RPM1Obj.innerHTML = SFM1/(D1*0.262);

SFM2bj = document.getElementById('txtSFM2');
RPM2Obj = document.getElementById('txtRPM2');
D2Obj = document.getElementById('tdD2');
document.getElementById('btnReset2').onclick = resetInputs;
document.getElementById('btnCalc2').onclick = calcD2;
}
function resetInputs() {
SFM2Obj.value = '';
RPM2Obj.value = '';
D2Obj.innerHTML = '';
}
function calcD2() {
var SFM2 = new Number(SFM2Obj.value);
var RPM2 = new Number(RPM2Obj.value);
D2Obj.innerHTML = '';
if(isNaN(SFM2) || isNaN(RPM2)) {
return;
}
D2Obj.innerHTML = SFM2/(RPM2*0.262);
}

&lt;/script&gt;
&lt;body&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;&lt;label for="txtD"&gt;Tool Diameter&lt;/label&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type="text" id="txtD" /&gt;&lt;/td&gt;

&lt;td&gt;&lt;label for="txtRPM"&gt;RPM&lt;/label&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type="text" id="txtRPM" /&gt;&lt;/td&gt;

&lt;td&gt;SFM=&lt;/td&gt;
&lt;td id="tdSFM"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;button id="btnReset"&gt;Reset&lt;/button&gt;&lt;button id="btnCalc"&gt;Calculate&lt;/button&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;label for="txtSFM1"&gt;SFM&lt;/label&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type="text" id="txtSFM1" /&gt;&lt;/td&gt;

&lt;td&gt;&lt;label for="txtD1"&gt;Tool Diameter&lt;/label&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type="text" id="txtSFM1" /&gt;&lt;/td&gt;

&lt;td&gt;RPM=&lt;/td&gt;
&lt;td id="tdRPM1"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;button id="btnReset1"&gt;Reset&lt;/button&gt;&lt;button id="btnCalc1"&gt;Calculate&lt;/button&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;label for="txtSFM2"&gt;SFM&lt;/label&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type="text" id="txtSFM2" /&gt;&lt;/td&gt;

&lt;td&gt;&lt;label for="txtRPM2"&gt;RPM&lt;/label&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type="text" id="txtRPM2" /&gt;&lt;/td&gt;

&lt;td&gt;Tool Diameter=&lt;/td&gt;
&lt;td id="tdD2"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;button id="btnReset2"&gt;Reset&lt;/button&gt;&lt;button id="btnCalc2"&gt;Calculate&lt;/button&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
``````

</html>