Thanks, I actually got it figured out. Click here to see it in action. It was something like what you just listed, i messed with it that way for awhile then found where I was missing. the script was this:
Code:
<script>
(function () {
function calculateGearing(pinion, spur) {
pinion = parseFloat(pinion);
spur =
parseFloat(spur);
return (spur / pinion * 2.7);
}
var gearing = document.getElementById("gearing");
if (gearing) {
gearing.onsubmit = function () {
this.weight.value = calculateGearing(this.Pinion.value, this.spur.value);
return false;
};
}
}());
</script>
and needed to be:
Code:
<script>
(function () {
function calculateGearing(model, pinion, spur) {
model =
parseFloat(model);
pinion = parseFloat(pinion);
spur =
parseFloat(spur);
return (spur / pinion * model);
}
var gearing = document.getElementById("gearing");
if (gearing) {
gearing.onsubmit = function () {
this.weight.value = calculateGearing(this.model.value, this.pinion.value, this.spur.value );
return false;
};
}
}());
</script>
Bookmarks