0

如何识别选定的单选按钮值或检查条件。我一直在开发以下代码,但我不明白为什么如果我检查 IsPerDay,IsPerDay 不会返回到控制器检查。如何在控制器中查看单选按钮检查或未检查?

看法

<script type="text/javascript">
    function EveryDay() {
        document.getElementById('RdIsPerDay').checked = true;
        document.getElementById('RdIsPerWeekDay').checked = false;
        document.getElementById("txtPerDay").style.visibility = 'visible';
        document.getElementById("lblPerday").style.visibility = 'visible';
    }
    function EveryWeekDay() {
        document.getElementById('RdIsPerDay').checked = false;
        document.getElementById('RdIsPerWeekDay').checked = true;
        document.getElementById("txtPerDay").style.visibility = 'hidden';
        document.getElementById("lblPerday").style.visibility = 'hidden';
    }
</script>


4

1 回答 1

1

您没有为单选按钮分配任何值。将此添加到您的代码中并检查:-

<script type="text/javascript">
    function EveryDay() {
    document.getElementById('RdIsPerDay').checked = true;
    document.getElementById('RdIsPerWeekDay').checked = false;
    //add this to your code
    document.getElementById('RdIsPerDay').value= true;
    document.getElementById('RdIsPerWeekDay').value= false;

    document.getElementById("txtPerDay").style.visibility = 'visible';
    document.getElementById("lblPerday").style.visibility = 'visible';
}
function EveryWeekDay() {
    document.getElementById('RdIsPerDay').checked = false;
    document.getElementById('RdIsPerWeekDay').checked = true;
    //add this to your code
    document.getElementById('RdIsPerDay').value= false;
    document.getElementById('RdIsPerWeekDay').value= true;

    document.getElementById("txtPerDay").style.visibility = 'hidden';
    document.getElementById("lblPerday").style.visibility = 'hidden';
}
</script>
于 2012-07-25T13:36:39.297 回答