PDA

View Full Version : i stink at this, i need help with a calculator


ST_Frank
01-09-2006, 08:11 PM
<html>
<form name="cal">
<input type="text" name="chamber_dia" size="10" value="0" onchange="javascript(document.cal.chamber_dia.value / 2 *

document.cal.chamber_dia.value / 2 * 3.14159 * document.cal.chamber_length.value = document.cal.chamber_volume.value)">
<br>
<input type="text" name="chamber_length" size="10" value="0" onchange="javascript(document.cal.chamber_dia.value / 2 *

document.cal.chamber_dia.value / 2 * 3.14159 * document.cal.chamber_length.value = document.cal.chamber_volume.value)">
<br>
<input type="text" name="chamber_volume" size="10" readonly>
<br>
<input type="text" name="barrel_dia" size="10" value="0" onchange="javascript(document.cal.barrel_dia.value / 2 *

document.cal.barrel_dia.value / 2 * 3.14159 * document.cal.barrel_length.value = document.cal.barrel_volume.value)">
<br>
<input type="text" name="barrel_length" size="10" value="0" onchange="javascript(document.cal.barrel_dia.value / 2 *

document.cal.barrel_dia.value / 2 * 3.14159 * document.cal.barrel_length.value = document.cal.barrel_volume.value)">
<br>
<input type="text" name="barrel_volume" size="10" readonly>
<br>
<input type="button" name="cb_ratio_cal" value="Calculate Your Chamber to Barrel Ratio" onclick="javascript

(document.cal.chamber_volume.value / document.cal.barrel_volume.value = document.cal.cb_ratio.value)">
<br>
<input type="text" name="cb_ratio" size="10" readonly>
<br>
<input type="text" name="meter_dia" size="10" value="0" onchange="javascript(document.cal.meter_dia.value / 2 *

document.cal.meter_dia.value / 2 * 3.14159 * document.cal.meter_length.value = document.cal.meter_volume.value)">
<br>
<input type="text" name="meter_length" size="10" value="0" onchange="javascript(document.cal.meter_dia.value / 2 *

document.cal.meter_dia.value / 2 * 3.14159 * document.cal.meter_length.value = document.cal.meter_volume.value)">
<br>
<input type="text" name="meter_volume" size="10" readonly>
<br>
<input type="text" name="best_mix" value="4.03%" readonly>
<br>
<input type="button" name="best_pressure_cal" value="Calculate Your Recommended Propane Volume in Chamber"

onclick="javascript(document.cal.chamber_volume.value * 0.0403 = document.cal.best_propane_volume.value)">
<br>
<input type="text" size="10" name="best_propane_volume" readonly>
<br>
<input type="button" name="best_pressure_cal" value="Calculate Your Recommended Propane Volume in Chamber"

onclick="javascript(document.cal.best_propane_volume.value * 14.6 = document.cal.best_propane_pressure.value)">
<br>
<input type="text" size="10" name="best_propane_pressure" readonly>
</form>
</html>

thats the what i began with, i know that my onchange="" and my onclick="" are all wrong, but i dont know how to fix it. if some1 could fix the first few as an example for me, i *may* be able to figure the rest out.

thanks for at least reading my post, i really hope some1 can help.

erisco
01-09-2006, 08:21 PM
*cough* Wrong forum. You may also want to describe your problem in specific, as just blankly saying they "don't work" is a bit general.

ST_Frank
01-09-2006, 08:36 PM
Having trouble with your form in IE?
thats the 1st thing i saw
or should be in Client Side Scripting place?
i'm an idiot, move this if any mod wanna.

bw, i dont know any javascript, i dont know to make a box display the result of a simple calculation: doc.form.input.value + doc.form.input2.value