Subject: Textbox
Posted By: srikant_jan Post Date: 10/25/2006 11:52:10 AM
I am having three text box t1,t2 and t3. The results of t1+12 has to be shown in t3 when ever i am changing either t1 or t2. I tried doing it by handling text changed event but it works when i take away the focus from either t1 or t2 and secondly it gets focused back to either t1 or t2. How can i do the online changes made to t1 or t2 would reflect in t3 by adding it.

Janamanchi Shrikanth N R
Reply By: Skb Reply Date: 11/10/2006 5:04:44 AM
u can try the following.

code behind:
------------
t1.attributes.add("onkeypress","Calculate(this)");
t2.attributes.add("onkeypress","Calculate(this)");

Javascript:
------------
function Calculate(obj)
{
   var val1 = document.getElementById("t1").value;
   var val2 = document.getElementById("t2").value;
   var val3 = val1 + val2;
   document.getElementById("t3").value = val3;
}


Go to topic 51975

Return to index page 124
Return to index page 123
Return to index page 122
Return to index page 121
Return to index page 120
Return to index page 119
Return to index page 118
Return to index page 117
Return to index page 116
Return to index page 115