hi,
i have this code:
...
function calc2(form){
if(form.units[0].checked) {
var span=parseFloat(form.span.value);
var width=parseFloat(form.width.value);
} else {
var span=(parseFloat(form.span.value)*2.54)*10;
var width=(parseFloat(form.width.value)*2.54)*10;
}
var slope1=String(parseFloat(form.slope.value)).substring(0,1);
var slope2=String(parseFloat(form.slope.value)).substring(3,1);
var baywidth=(width - 32)/numbays;
var height=span*(Math.sqrt((slope1*slope1)+(slope2*slope2))/slope2);
var barea=(height/1000)*(baywidth/1000);
if(barea > 20 ) {
alert("Please change input value, bay area is over limit " + barea + " m2");
}
}
...
...
<select size="1" name="motor" id="motor" onChange="calc2(this.form);">
<?php
if($md=='lb'){
echo ' <option selected value="0"> </option>';
echo ' <option value="120"> 120V </option>';
echo ' <option value="220"> 220V </option>';
} else {
echo ' <option selected value="0"> </option>';
echo ' <option value="220"> 220V </option>';
echo ' <option value="120"> 120V </option>';
}
?>
<option value="none"> None </option>
</select>
...
trouble is that calc2 function is not activated neither on change or blur.
any idea please?
i have this code:
...
function calc2(form){
if(form.units[0].checked) {
var span=parseFloat(form.span.value);
var width=parseFloat(form.width.value);
} else {
var span=(parseFloat(form.span.value)*2.54)*10;
var width=(parseFloat(form.width.value)*2.54)*10;
}
var slope1=String(parseFloat(form.slope.value)).substring(0,1);
var slope2=String(parseFloat(form.slope.value)).substring(3,1);
var baywidth=(width - 32)/numbays;
var height=span*(Math.sqrt((slope1*slope1)+(slope2*slope2))/slope2);
var barea=(height/1000)*(baywidth/1000);
if(barea > 20 ) {
alert("Please change input value, bay area is over limit " + barea + " m2");
}
}
...
...
<select size="1" name="motor" id="motor" onChange="calc2(this.form);">
<?php
if($md=='lb'){
echo ' <option selected value="0"> </option>';
echo ' <option value="120"> 120V </option>';
echo ' <option value="220"> 220V </option>';
} else {
echo ' <option selected value="0"> </option>';
echo ' <option value="220"> 220V </option>';
echo ' <option value="120"> 120V </option>';
}
?>
<option value="none"> None </option>
</select>
...
trouble is that calc2 function is not activated neither on change or blur.
any idea please?