javascriptinputhtml-tablerowvisualforce

Calculate total value in a table row with javascript in visualforce page?


i have a table with 3 column in visualforce page there is one input value and others are output value. When input value is changes, input value and second column value must be multiplied and the third column must show the result for per row. in table i'm using apex:repeat and , tags so how can i do this? thanks.

i have tried add js method to vf page with parameter and call this method with 'this' attribute in tag like onchange="calc(this)" but did not work.


Solution

  • i changed my code like this and it works.

    vf page:

    <apex:input id="qua" onchange="calc(this)"/>
    

    js code:

    function calc(p){
        var qua = p.value;
        var row = p.parentNode.parentNode;
        var pack = row.cells[6].innerHTML;        
        row.cells[7].innerHTML = qua * pack;
    }