动态表输入值计算

时间:2018-11-12 15:40:58

标签: javascript

我正在尝试获取动态表格单元格的值。以下是代码,但我只能得到未定义

下面给出的Javascript和HTML:

package Tiny;

use Scalar::Util qw(refaddr weaken);

sub new {
    my ( $class, $tiny, $large ) = @_;
    return bless { tiny => $tiny, large => $large }, $class;
}

# Ugly temporary storage to hold $large refs from _freeze to _thaw...
my %largeWeakRefs;
sub STORABLE_freeze {
    my ( $self, $cloning ) = @_;
    my $large = delete local $self->{large};
    my $refaddr = refaddr $large;
    $largeWeakRefs{$refaddr} = $large;
    weaken $largeWeakRefs{$refaddr};
    my %restOfSelf = %$self;
    $self->{large} = $large;
    return $refaddr, \%restOfSelf;
}

sub STORABLE_thaw {
    my ($self, $cloning, $refaddr, $restOfSelf) = @_;
    %$self = %$restOfSelf;
    $self->{large} = $largeWeakRefs{$refaddr};
    return $self;
}
function calcTot(i) {

            unitPrice = document.getElementById("invoice_details").rows[i].cells[6].innerHTML.value;//gets the unit price for the item
            alert(unitPrice);
            quantity = document.getElementById("invoice_details").rows[i].cells[7].childNodes[0].value;
            //alert(quantity);
            dis = document.getElementById("invoice_details").rows[i].cells[8].children[0].value;
           //alert(dis);
            final_amt = (parseFloat(unitPrice) * parseFloat(quantity)) - (parseFloat(unitPrice) * parseFloat(quantity) * parseFloat(dis)) / 100;
           //alert(final_amt);
            document.getElementById("invoice_details").rows[i].cells[9].childNodes[0].value = final_amt.toFixed(2);
            //calcTotal();



        }

0 个答案:

没有答案