Tuesday, August 4, 2009

On lost focus of textbox get the product of two textboxes in javascript.

Hi,
Please check the following code:

function Prod(input1,input2,output)
{
var first = document.getElementById(input1);
var second = document.getElementById(input2);
var third = document.getElementById(output);

third.value = first.value * second.value;
}

Use the html textboxes and on the second textbox call the function onblur

onblur="Prod('txtVal','txtVal2','txtProd');"

No comments: