onclick在Firefox 4.0中不会触发,但在Firefox 2.0中有效

时间:2012-03-06 11:59:32

标签: javascript firefox triggers onclick

我有一个在Firefox 2.0中触发的单选按钮,但它不会在Firefox4.0中触发。单选按钮html在下面,然后是应该触发的javascript。如果有人可以提供帮助,那么为什么它不起作用感到困惑。

<td class="Label" colspan="3">
<input class="Label" type="radio" tabindex="3" onclick="document.lending.sec5vallchoice.value=this.value;onGuaranteeChange();" value="3" name="sec5vall">The text beside radio button</td>

// Letter of Guarantee
case SecText5:

        if(sec5val1[rowNumber] == "1") {
            document.lending.sec5val1[0].checked = true;
        }
        else if(sec5val1[rowNumber] == "2") {
            document.lending.sec5val1[1].checked = true;
        }
        else if(sec5val1[rowNumber] == "3") {
            document.lending.sec5val1[2].checked = true;
        }
        else {
            document.lending.sec5val1[3].checked = true;
        }

        document.lending.sec5val1choice.value = sec5val1[rowNumber];
        onGuaranteeChange();

        document.lending.sec5val2.value = sec5val2[rowNumber];
        document.lending.sec5val3.value = sec5val3[rowNumber];

        disableTab(61);
        disableTab(65);
        disableTab(68);
        disableTab(67);
        disableTab(74);
        disableTab(75);
        disableTab(76);
        disableTab(77);
        disableTab(78);
        disableTab(79);
        disableTab(80);
        disableTab(81);
        disableTab(82);
        disableTab(83);
        disableTab(84);
        disableTab(85);
        disableTab(86);
        disableTab(66);
        disableTab(69);
        disableTab(87);

        showPanel(71, 'panel71');
        document.lending.sec5val1[0].focus();
        break;

功能:

function onGuaranteeChange() {
if(document.lending.sec5val1choice.value == "3") {
    document.getElementById("loglabel1").innerText = "Enter Life Policy/Mortgage Details";
    document.getElementById("loglabel2").innerText = "";
}
else {
    document.getElementById("loglabel1").innerText = "Amount of Guarantee";
    document.getElementById("loglabel2").innerHTML = "&#163;";
}

}

1 个答案:

答案 0 :(得分:0)

innerHTML而不是innerText工作! :)