0

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?

2 Answers 2

2

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;
}
Sign up to request clarification or add additional context in comments.

Comments

0

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;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.