Results 1 to 4 of 4

Thread: Help with a dynamic table/calculator

  1. #1
    Join Date
    Dec 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with a dynamic table/calculator

    I want to add something simple to my friends' site but know only a little bit of js.

    What I want to work off of, is a dynamic table with 3 rows of 4 columns.
    Column A would be a number entered by the user.
    Column B would be - / + or * function entered by the user.
    Column C would be another number entered by the user.
    Column D would be the total.
    Example : 5 + 25 = 30

    Also I saw a page once where you could click a button and it added a new row of columns to a table like the one I want to work on and another button to remove it.

    I've been reading and working on figuring this out but my js skills go as far as basic forms and not much with dynamic stuff.

    Thanks in advance.

  2. #2
    Join Date
    Dec 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    anyone?

  3. #3
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    seems like you're going at this backwards. http://www.javascriptkit.com/script/cut18.shtml

    if not can u provide example of what you're trying to do?

  4. #4
    Join Date
    Dec 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks , I found something online that I'd like to have and once it's working I could modify it to my needs :
    ----------------------------------
    The table should have three rows as pictured to start.
    Each row has a Value A, Value B, and Operation textbox.
    After each one has been changed, validate it.
    I want to make sure that only numbers are allowed in the Value fields
    Only +, -, /, and * allowed in Operation field.
    After each one has been changed, calculate the total for that row and for the whole spreadsheet.
    If a row’s total is negative, color the box red.
    If a row’s total is positive, color the box green.
    When the user presses the “Add New Calculation” button, add a new row above the last row (total).
    When the user presses the “Remove Last Row” button, remove the last row.
    Do not let the user remove all the rows, always keep one calculation row and the total row.
    Update the totals after each add/remove.



    Once it's like that above. I will add personalization and more stuff, but I just can't figure out the code for it.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •