javascript null.valueAsNumber无法转换为Object

时间:2013-10-23 22:43:35

标签: javascript adobe

我是javascript的新手,我正在磕磕绊绊。我试图使用javascript根据表单中的三个不同值计算一个值。问题是我得到的唯一输出是: [Line:00004 {(null)}]:Null null.valueAsNumber无法转换为Object

以下是示例代码:

function YellowPay(aNames) {
    var MaxYellow, YellowMil, YellowGallons, Mil, PayGals;
    MaxYellow = this.getField(aNames[1]).valueAsNumber;
    YellowMil = this.getField(aNames[2]).valueAsNumber;
    YellowGallons = this.getField(aNames[3]).valueAsNumber;
    Mil = Math.round(YellowMil * 100) / 100;
    PayGals = "";
    if (Mil >= 25) {
        PayGals = MaxYellow;
    } else if (Mil >= 20) {
        PayGals = YellowGallons;
    } else if (Mil >= 18) {
        PayGals = YellowGallons * 0.75;
    } else if (Mil >= 17) {
        PayGals = YellowGallons * 0.5;
    } else {
        PayGals = 0;
    }
    YellowPay = PayGals;
}
event.value = YellowPay(["MaxYellow", "YellowMil", "YellowGallons"]);

0 个答案:

没有答案