Shaun Furlong said:
I'm new to this group - and newsgroups in general - so I aplogize if I'm out
of line here...
I'm a web designer, but not proficient in JS.
I need a quote for a simple "Density Calculator" in JS. Here are two
examples (not JS):
1.
http://www.cheeseman.com/Density-Calculator.asp
2.
http://www.myyellow.com/dynamic/services/yfsdensitycalculator/sitedensitycal
culator.jsp?PARENT=yfscjhowtoshipfromservices
Will this help -- though it has no error checking?
<html>
<head>
<title>Density Calculator</title>
<script type="text/javascript">
function calc() {
var decs = 5; // = decimal positions displayed
var form = document.form1;
var l_ft = parseInt(form.L_ft.value,10);
var l_in = parseInt(form.L_in.value,10);
var w_ft = parseInt(form.W_ft.value,10);
var w_in = parseInt(form.W_in.value,10);
var h_ft = parseInt(form.H_ft.value,10);
var h_in = parseInt(form.H_in.value,10);
var o_lb = parseInt(form.O_lb.value,10);
var o_oz = parseInt(form.
z.value,10);
var c_ft = l_ft * w_ft * h_ft;
var c_in = l_in * w_in * h_in;
var cube = (12 * c_ft + c_in) / 12;
var wait = (16 * o_lb + o_oz) / 16;
var dens = wait / cube;
dens = dens.toString()
if (dens.indexOf(".") >= 0) {
dens = dens.substr(0,dens.indexOf(".")+decs+1);
}
form.Cube.value = cube;
form.Dens.value = dens;
}
function init() {
var form = document.form1;
form.L_ft.focus();
form.L_ft.select();
}
window.onload = init;
</script>
</head>
<body>
<pre>
<b>Calculate Density</b>
<form name="form1">
<b>Length: </b><input type="text" name="L_ft"
size="6" value="0" style="text-align:right"> Feet
<b> </b><input type="text" name="L_in"
size="6" value="0" style="text-align:right"> Inches
<b>Width : </b><input type="text" name="W_ft"
size="6" value="0" style="text-align:right"> Feet
<b> </b><input type="text" name="W_in"
size="6" value="0" style="text-align:right"> Inches
<b>Height: </b><input type="text" name="H_ft"
size="6" value="0" style="text-align:right"> Feet
<b> </b><input type="text" name="H_in"
size="6" value="0" style="text-align:right"> Inches
<b>Weight: </b><input type="text" name="O_lb"
size="6" value="0" style="text-align:right"> Pounds
<b> </b><input type="text" name="
z"
size="6" value="0" style="text-align:right"> Ounces
<input type="button" value="Calculate" onclick="calc()"
style="background-color:white; width:110px">
<b> </b><input type="text" name="Cube" readonly
size="6" value="0" style="text-align:right"> Cubic Feet (ft<sup>3</sup>)
<b> </b><input type="text" name="Dens" readonly
size="6" value="0" style="text-align:right"> lbs/ft<sup>3</sup>
<input type="reset" value="Clear" onclick="init()"
style="background-color:white; width:110px">
</form>
</pre>
</body>
</html>
Watch for word-wrap.
It may not be the best solution but it is "a" solution.
Or did you "need" to pay for a solution.