tags:

views:

576

answers:

2

Work on ASP.net vs 05 C#,There are three textBox.Length,Height,Sft.I want to multiply Length*Height and want to put value on Sft text.

  <asp:TextBox ID="txtLength" runat="server"></asp:TextBox>
                <asp:TextBox ID="txtHeight" runat="server" onblar="javascript:ComputeSft(  );" ></asp:TextBox>
                <asp:TextBox ID="txtSft" runat="server"></asp:TextBox></td>



Sft=Length*Height.

function ComputeSft()
{
   var _nLength, _nHeight,_nSft;
    _nLength=document.getElementById("txtLength").innerText;
    _nHeight=document.getElementById("txtHeight").innerText;
    _nSft=_nLength*_nHeight;
    alert(_nSft);
    txtSft.Text=_nSft;
}

How to multiply? and How to set multiply value on textbox?

A: 

The code you have written is a javascript there is no innerText in javascript use value instead

var txtSft=document.getElementById('<id of sfttext>');
txtSft.value=_nSft;
Xinus
+2  A: 

I believe what you are looking for is the value property.

Try this:

function ComputeSft()
{
    var _nLength = document.getElementById("txtLength").value;
    var _nHeight = document.getElementById("txtHeight").value;
    var _nSft = _nLength * _nHeight;
    alert(_nSft);
    document.getElementById("txtSft").value = _nSft;
}
Austin Hyde