-1
function onLoadMoneyEarned(size){
    for(var i=1;i<=size;i++){
        var countStr1 = 'howOften__JB1_'+i;
        var countStr2 = 'howOften__JB2_'+i;
        var countStr3 = 'howOften__JB3_'+i;
        var countStr4 = 'howOften__JB4_'+i;

        var hrsPerWeek1 = 'hrsPerWeek__JB1_'+i
        var hrsPerWeek2 = 'hrsPerWeek__JB2_'+i
        var hrsPerWeek3 = 'hrsPerWeek__JB3_'+i
        var hrsPerWeek4 = 'hrsPerWeek__JB4_'+i

        var dropDownValue1 = document.getElementById(countStr1).value;
        var dropDownValue2 = document.getElementById(countStr2).value;
        var dropDownValue3 = document.getElementById(countStr3).value;
        var dropDownValue4 = document.getElementById(countStr4).value;

        var textbox1 = document.getElementById(hrsPerWeek1);
        textbox1.disabled = true;
        var textbox2 = document.getElementById(hrsPerWeek2);
        textbox2.disabled = true;
        var textbox3 = document.getElementById(hrsPerWeek3);
        textbox3.disabled = true;
        var textbox4 = document.getElementById(hrsPerWeek4);
        textbox4.disabled = true;

        if(dropDownValue1=="HR"){
            textbox1.disabled = false;
        }
        if(dropDownValue2=="HR"){
            textbox2.disabled = false;
        }
        if(dropDownValue3=="HR"){
            textbox3.disabled = false;
        }
        if(dropDownValue4=="HR"){
            textbox4.disabled = false;
        }
    }

这是在IE中工作的那个..

我这样调用脚本

<script  language="javascript" type="text/javascript">
$(window).load(function(){onLoadMoneyEarned("<%=nameLength%>");});
</script>

该脚本的主要功能是仅当我们在旁边的下拉列表中选择每小时时才启用小时数文本字段。但它在 Firefox 中引发验证错误

任何帮助表示赞赏

4

1 回答 1

0

结尾的花括号似乎不见了。尝试在 onLoadMoneyEarned 函数的最后添加一个结束 }。

于 2012-04-24T14:35:44.940 回答