hemanth kumar

hemanth kumar

  • NA
  • 28
  • 4.1k

How to get the javascript function value in textbox?

Jul 28 2011 2:47 AM
hi,

i am write the javascript function like this, my problem is i can pass the values (quantity and price ) retrive amount, print the amount in lable and textbox(same values), but label is working and textbox value after select another operation first value will come , what is the problem in the code or any modification (i am using OnChange event) and some time working with IE browser (but add the master page doesnot work any browser)

Divfunction Total(Quantity,Price,Amt)
{
var Quan=document.getElementById(Quantity).value;
var Pric=document.getElementById(Price).value;
var tt=document.getElementById('lblTotal').innerHTML;


//var h=document.getElementById('h1').value;


//tt=h;
if(tt=='')
{
tt=0;
}


if(Quan=='')
{


}
else
{
var cc1=document.getElementById(Amt).value;
if(cc1!='')
{
tt=parseFloat(tt)-parseFloat(cc1);
}
document.getElementById(Amt).value=(parseFloat(Quan)*parseFloat(Pric)).toFixed(2);
var cc=document.getElementById(Amt).value;
//document.getElementById(Amt).value=cc.toFixed(2);
document.getElementById('lblTotal').innerHTML = (parseFloat(tt)+parseFloat(cc)).toFixed(2);
document.getElementById('h1').value=document.getElementById('lblTotal').innerHTML;
document.getElementById("<%= TextBox1.ClientID %>").innerText =document.getElementById('lblTotal').innerHTML;


}



Answers (2)