Click here to Skip to main content
14,669,375 members
Rate this:
Please Sign up or sign in to vote.
See more: , +
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            var textBox1 = $('input:text[id$=FreightCharge]').keyup(foo);
            var textBox2 = $('input:text[id$=FuelSurcharge]').keyup(foo);
            var textBox3 = $('input:text[id$=FOV]').keyup(foo);
            var textBox4 = $('input:text[id$=COD]').keyup(foo);
            var textBox5 = $('input:text[id$=FOD]').keyup(foo);
            var textBox6 = $('input:text[id$=PickupCharge]').keyup(foo);
            var textBox7 = $('input:text[id$=DoorDelivery]').keyup(foo);
            var textBox8 = $('input:text[id$=Handling]').keyup(foo);
            var textBox9 = $('input:text[id$=Misc]').keyup(foo);
            var textBox10 = $('input:text[id$=DktCharge]').keyup(foo);

            function foo() {
                var value1 = textBox1.val();
                var value2 = textBox2.val();
                var value3 = textBox3.val();
                var value4 = textBox4.val();
                var value5 = textBox5.val();
                var value6 = textBox6.val();
                var value7 = textBox7.val();
                var value8 = textBox8.val();
                var value9 = textBox9.val();
                var value10 = textBox10.val();
                var sum = add(value1, value2, value3, value4, value5, value6, value7, value8, value9, value10);
                $('input:text[id$=SubTotal]').val(sum);
            }

            function add() {
                var sum = 0;
                for (var i = 0, j = arguments.length; i < j; i++) {
                    if (IsNumeric(arguments[i])) {
                        sum += parseFloat(arguments[i]);
                    }
                }
                return sum;
            }
            function IsNumeric(input) {
                return (input - 0) == input && input.length > 0;
            }

        });

What I want to is I have sum of 10 textboxes in the 11 textbox I want to multiply the 11 textbox by *12.36 put its value in the 12textbox and the sum of 11 and 12 textbox in the 13 textbox. is there any way
Posted
Updated 16-Mar-15 20:07pm
v2

1 solution

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

Solution 1

Following Example will help you

<input name="box1" type="text" /><br />
<input name="box2" type="text" /><br />
<input name="box3" type="text" />

<$('input[name="box2"]').keyup(function() {
    var a = $('input[name="box1"]').val();
    var b = $(this).val();
    $('input[name="box3"]').val(a * b);
});


Happy coding hours ;)
   
v2

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