如何编码Radiobuttonlist跳过检查启用Ordisable另一个Radiobuttonlist? [英] How Do I Code A Radiobuttonlist Skip To Check Enable Ordisable Another Radiobuttonlist?

查看:70
本文介绍了如何编码Radiobuttonlist跳过检查启用Ordisable另一个Radiobuttonlist?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试过以下代码:

have tried the below code:

function GLUpos() {

    var ResultsGLU = document.getElementById('rbnGLU');
    var ResultsGLU2 = ResultsGLU.getElementsByTagName('input');

    if (ResultsGLU2[0].checked) {

        document.form1['rbnPosGLU'].item(0).disabled = false;
        document.form1['rbnPosGLU'].item(1).disabled = false;
        document.form1['rbnPosGLU'].item(2).disabled = false;
        document.form1['rbnPosGLU'].item(3).disabled = false;
        document.form1['rbnPosGLU'].item(4).disabled = false;
        document.getElementById('rbnPosGLU').disabled = false;
    }


    if (ResultsGLU2[1].checked) {

        document.form1['rbnPosGLU'].item(0).disabled = true;
        document.form1['rbnPosGLU'].item(1).disabled = true;
        document.form1['rbnPosGLU'].item(2).disabled = true;
        document.form1['rbnPosGLU'].item(3).disabled = true;
        document.form1['rbnPosGLU'].item(4).disabled = true;
        document.form1['rbnPosGLU'].item(0).checked = false;
        document.form1['rbnPosGLU'].item(1).checked = false;
        document.form1['rbnPosGLU'].item(2).checked = false;
        document.form1['rbnPosGLU'].item(3).checked = false;
        document.form1['rbnPosGLU'].item(4).checked = false;
        document.getElementById('rbnPosGLU').disabled = true;
    }

}

推荐答案

使用jquery。使用事件。使复选框状态更改时触发的事件代码,然后您的代码可以比这简单得多。它可以重置所有其他复选框,但是你点击的复选框(在方法的上下文中是'this')
Use jquery. Use events. Make event code that fires when a check boxes state is changed, then your code can be a lot simpler than this. It can reset all other checkboxes but the one you clicked ( which is 'this' in the context of your method )


这篇关于如何编码Radiobuttonlist跳过检查启用Ordisable另一个Radiobuttonlist?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆