Click here to Skip to main content
14,447,105 members
Rate this:
Please Sign up or sign in to vote.
See more: , +
i have four textboxes

first two texboxes show the sum
and last two textboxes show the sum when i am curser down how to automatically
calculate the sum. with out use any script language. is it posible to write code
textbox.
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 3

function CalculateSum()
    {

        var Form = document.frmsum;
        var txtbx1=  Form.txt1.value;
        var txtbx2 = Form.txt2.value;
        var txtbx3 = Form.txt3.value;
        var txtbx4 = Form.txt4.value; 
       var allsum = Number(txtbx1)+Number(txtbx2)+Number(txtbx3)+Number(txtbx4);
        if(!isNaN(allsum) && allsum !=Infinity)
        {
            Form.txtsum.value = allsum;
        }
        return CheckZero()
    }


on page load

txtsum.Attributes.Add("onblur", "return CalculateSum()");


Thanks
Ashish
   
Comments
Vani Kulkarni 6-Aug-12 3:14am
   
Good answer!
AshishChaudha 6-Aug-12 3:17am
   
Thanks Vani
Rate this:
Please Sign up or sign in to vote.

Solution 2

This is not possible to show the sum without handling any event of the textboxes. You should handle the JavaScript event to show the sum.


--Amit
   
Rate this:
Please Sign up or sign in to vote.

Solution 1

There is Mouse Down Event and Mouse up event is there in event property click that event and in side event do your code
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100