PDA

View Full Version : display computed value (on blur) in cell



vikaspa
09-13-2009, 02:23 PM
This might have been answered but still asking

there are say 2 fields

Qty
rate

I am computing product cost on blur event nd displaying in 3rd field
say pcost

For this I have defined 3 text fields
qty
rate
pcost

how can i display pcost without defining a field i.e. in a cell

thenajsays
09-13-2009, 03:38 PM
add an id to the cell, then add an onblur event to the rate field, like this:

<td id="pcost"></td>
and


<input type="text" name="qty" id="qty">
<input type="text" name="rate" id="rate" onblur="document.getElementById('pcost').innerHTML = document.getElementById('qty').value * document.getElementById('rate').value">