Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select event

Status
Not open for further replies.

ttuser4

MIS
Jun 19, 2008
147
0
0
CA
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?
 
sorry, my apology. i missed value for 'numbays'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top