javascript - Retrieving Info from Text Box -
i have been able create progress on programme running problem can't quite figure out. in script, when text box loses focus supposed update total cost. @ point retrieves number html code, not retrieving number input.
function productcosts() { var totalmap = document.getelementbyid('qty1'); var quantity1 = parsefloat($("qty1").value); var price1 = parsefloat($('price1').value); var totalmapblur = function() { var totalmapcost = $('cost1'); totalmapcost = (quantity1) * (price1); alert(price1); alert(quantity1); alert(totalmapcost); } qty1.onblur = (totalmapblur); } i have created fiddle can see of code. http://jsfiddle.net/krfjd/1/
any help appreciated.
p.s. if sense question not written enough, please allow me know how improve, don't review question negatively. trying.
the problem set quantity1when phone call productcosts() when document first loaded. don't update when user edits input field. , if want cost column updated, have assign value.
var totalmapblur = function() { var quantity1 = $('qty1').value; var totalmapcost = (quantity1) * (price1); alert(price1); alert(quantity1); alert(totalmapcost); $('cost1').value = totalmapcost; } fiddle
javascript
No comments:
Post a Comment