Problem

    Date: 02/11/09 (Javascript Community)    Keywords: asp, java

    Hello.

    I'll start off by saying I suck at Javascript.

    I have a classic ASP page which has a basic 2D table. The rows of text boxes are dynamically created and have names like txtItem1, txtItem2, txtQuantity1, txtQuantity2, etc. There are 10, but of the 10, they will rarely all be used. If the user needs more than 10, they can create another ten rows by pressing a button and submitting the form, so potentially the controls can be numbered up to 20 and up to 20 used.

    I need to multiply 2 columns (txtItem and txtQuantity) of user inputted data and put the value in a 3rd column (txtTotal - appended with whatever row number it happens to be in as the rest of the controls are named). There may or may not be data in these fields, even if there is other data in the row, the user wants the option to just type in the value of the total "manually" as that is how the business works.

    I need to do this on the fly, the user does not want to post back, so I have to use client side scripting.

    Additionally, of these txtTotal fields, I need a subtotal at the bottom of the column.

    Then I need to calculate a percentage, show it, and add it to the total for a grand total.

    I'm a little overwhelmed.

    If I could get some help with any of the three or so tasks I have:

    1. Multiplying field one by field two giving field three... only if there is data to calculate.
    2. Adding a column of fields of a variable number (ignore fields that are not populated) to give a grand total.
    3. Calculate a percentage of the grand total, and total that again for a final total.

    I would be forever in your debt, eternally grateful, and blissfully happy. Thank you in advance, a thousand times.

    I've searched and found a few scripts that don't seem to do exactly what I want, so I'm begging.

    Source: http://community.livejournal.com/javascript/164951.html

« Photo Gallery wanted || Validation help! »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home