www.webdeveloper.com
Results 1 to 9 of 9

Thread: Dynamic Form Field Calculation

Threaded View

  1. #1
    Join Date
    Oct 2010
    Location
    UK
    Posts
    11

    Red face Dynamic Form Field Calculation

    Hi,

    I am trying to create some automatic calculations for a dynamic form.

    The complicated bit is that the user can add another row of fields to fill in, which would also need to be calculated.

    Here is what I have so far but it doesn't work!:

    Code:
    var counterx = 0 ;
    function calcu() {
    
    var targetmeh = "meh" + counterx ;
    var quantity = "quantity" + counterx ;
    var costtotal = "costtotal" + counterx ;
    var costours = "costours" + counterx ;
    
    document.getElementById(targetmeh).innerHTML = document.f1.elements.(quantity).value * (document.f1.elements.(costours).value - document.f1.elements.(costtotal).value);
    
    counterx++ ;
    
    	//document.getElementById('meh').innerHTML='test';
    
    //(document.f1.elements.productvalue.value * document.f1.elements.NoOfProducts.value);
    
    }
    Last edited by Kor; 10-06-2010 at 06:10 AM. Reason: wrap the code [code][/code]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles