Gurus. I am using onblur event to update price on a form. Script is working well in IE but I think FF does not support onBlur. How can I call update_price function onBlur event of FF.
Hello, FF does support onBlur, well 2.0.0.3 does anyway I've used it. It might be something else in your code that's stopping it working in firefox. If you post the bits that aren't working in FF someone might be able to help you. Sky22
For which element is the onblur event ? Maybe a select ? If yes, try with onchange="your_function_selected(this.selectedIndex)"
This is the function call <input name='cq1' type='text' id='cq1' size='5' maxlength='5' onblur="update_status(); show_price(); "> and following is the long show_price function function show_price(){ for (var i=0; i < document.frm1.stype.length; i++){ if (document.frm1.stype.checked){ var rad_val = document.frm1.stype.value; } } a = rad_val; flag_flat = flag_sheet = flag_fitted = 0 sheetcount = 0; if(document.frm1.ptypes[0].checked){ fitted = document.frm1.ptypes[0].value; } else fitted = 0; if(document.frm1.ptypes[1].checked){ flat = document.frm1.ptypes[1].value; } else flat = 0; if(document.frm1.ptypes[2].checked){ set = document.frm1.ptypes[2].value; } else set = 0; //alert(fitted) //else qty = 0; if(document.frm1.cq1.value != ""){ if(isNumber("frm1","cq1")==false){ alert("Please enter numeric quantity!"); document.frm1.cq1.focus(); return false; } qty = qty + parseFloat(document.frm1.cq1.value) } if(document.frm1.cq2.value != ""){ if(isNumber("frm1","cq2")==false){ alert("Please enter numeric quantity!"); document.frm1.cq2.focus(); return false; } qty = qty + parseFloat(document.frm1.cq2.value) } if(document.frm1.cq3.value != ""){ if(isNumber("frm1","cq3")==false){ alert("Please enter numeric quantity!"); document.frm1.cq3.focus(); return false; } qty = qty + parseFloat(document.frm1.cq3.value) } //alert(qty) flats = parseFloat(flat) * qty; fitteds = parseFloat(fitted) * qty; sheets = parseFloat(set) * qty; stypes = parseFloat(a) * qty; gtotal = flats + fitteds + sheets + stypes; ggtotal = gtotal.toFixed(2) //gtotal = total*qty document.getElementById('price').innerHTML = '$'+ggtotal; document.frm1.pprice.value = gtotal; if(document.frm1.pprice.value > 1) document.all['cart'].innerHTML= '<input type="submit" name="PlaceOrder" value="Add to Cart" style="font-size: 10pt; font-family: sans-serif; font-style: normal;" >'; else document.all['cart'].innerHTML = '<input type="submit" name="PlaceOrder" value="Add to Cart" style="font-size: 10pt; font-family: sans-serif; font-style: normal;" disabled="disabled">'; }
I'm not 100% sure but I think it might be you need to use document.getElementById("frm1") instead of document.frm1 but I'm not sure. Someone on here will know though Sky22
Suggestions: - Use event onChange instead of onBlur - Add name and id attributes to your checkboxes, so you can: - Use document.getElementById() function instead of getdocument.all Hope this help.