返回首页

大家好,

请检查下面它工作正常在IE浏览器,但没有在Mozila工作的代码。

这个场景是我的checkboxlist LIDT代码数据绑定背后。
如果用户选择列表的第一个项目,他是不是可以选择任何其他的和其他人将disbaled。
现在,如果用户选择的任何其他,房委会不能选择第一个,它会被自动禁用。
当用户取消选中的复选框可以在disbaled所有。

我已经做了它,它在IE浏览器的工作,请告诉我,我有什么做才能让Mozila和其他工作也

一种快速的答复是期待已久的!

代码为:

//To Enable and Disable check boxes of worker status

    function UnCheckAll() {

        if (document.getElementById("cblStatus").cells.innerText != "") {

            //Get the checkboxlist object 

            var checkBoxList = document.getElementById("cblStatus");

            //Get the number of checkboxes in the checkboxlist 

            var numCheckBoxItems = checkBoxList.cells.length;

            if (document.getElementById(checkBoxList.id + '_' + [0]).checked == true) {

                for (i = 1; i < numCheckBoxItems; i++) {

                    //Get the checkboxlist item 

                    var checkBox = document.getElementById(checkBoxList.id + '_' + [i]);

                    //Check if the checkboxlist item exists, and if it is checked

                    checkBox.checked = false;

                    checkBox.disabled = true;

                }

            }

            else {

                for (i = 1; i < numCheckBoxItems; i++) {

                    //Get the checkboxlist item 

                    var checkBox = document.getElementById(checkBoxList.id + '_' + [i]);

                    //Check if the checkboxlist item exists, and if it is checked

                    checkBox.disabled = false;

                }

                document.getElementById(checkBoxList.id + '_' + [0]).checked = false;

                document.getElementById(checkBoxList.id + '_' + [0]).disabled = true;

            }

            //Enable sourced now

            if (EnableSourced(numCheckBoxItems, checkBoxList)) {

                document.getElementById(checkBoxList.id + '_' + [0]).disabled = false;

            }          

        }

    }

//To enable sourced checkbox

    function EnableSourced(numCheckBoxItems, checkBoxList) {

        var RETVAL = false;

        for (i = 1; i < numCheckBoxItems; i++) {

            //Get the checkboxlist item 

            var checkBox = document.getElementById(checkBoxList.id + '_' + [i]);

            if (checkBox.checked == true) {

                return false;

            }

            else {

                RETVAL = true;

            }

        }

        return RETVAL;

    }
请检查代码是否有任何变化,它运行在Mozila ............
任何一个人可以帮助我,请.........先谢谢了............

任何一个,请帮我..................
确定任何一个不知道如何使它??????
我完全与此代码frustated的家伙,请帮助。它真正需要的。我不喜欢的JavaScript。因为它不是一个标准的语言,任何我怎么能写上面的代码,它的工作在IE浏览器,但在Mozila。请尝试解决这个问题。

请它解决!!!!!!!
???????????????

???????????
\
??

请帮助!!!!!!
? Firebug的,我不知道,请让解决?????
任何一个,请帮我,我怎么能找到ListBox中的总项目在mozila?然后检查它的Checked属性?
请HELPPPPPPPPPPP!!!!!!!11

{C}

回答

评论会员:游客 时间:2012/02/07
下载imgsrc=]为Firefox现在加入一个断点在Firebug调试功能,你会看到发生错误的搜索位,你应该能够找到如何解决这是更好的学习如何你可以解决这些问题,通过使用正确的调试工具
竞兰詹
评论会员:游客 时间:2012/02/07
Thanx每个人都试图选择我的查询它是worling在IE以及Firefox浏览器。但我感到沮丧...............太多...........但终于得到了.........//方法//首先,我发现我的源代码之前pageLoad的ListBox中的总项目//TOTLEN的-cblStatus.Items.Count.ToString()从后面代码//cblStatus.Attributes.Add的("的onclick","UnCheckAll("//cblStatus.Items.Count.ToString()")")功能UnCheckAll(TOTLEN){checkBoxList=("cblStatus)(("cblStatus_0)。检查==TRUE){ (I=1;我LT;TOTLEN;我){ VAR复选框=document.getElementById('cblStatus_"[I]); checkBox.checked=FALSE; checkBox.disabled=TRUE; } }否则{ (I=1;我LT;TOTLEN;我){ VAR复选框=document.getElementById('cblStatus_"[I]); checkBox.disabled=FALSE;} document.getElementById('cblStatus_0")。检查=FALSE;document.getElementById('cblStatus_0")。禁用=TRUE; }//使能源如果(EnableSourced(TOTLEN,checkBoxList)){ document.getElementById('cblStatus_0")。禁用=FALSE; }}//为了使采购复选框功能EnableSourced(TOTLEN,checkBoxList){VARRETVAL=FALSE;(I=1;我LT;TOTLEN;我){ //获取在CheckBoxList项目VAR复选框=document.getElementById('cblStatus_"[I]); 如果(checkBox.checked==TRUE){返回false; }否则{RETVAL= }}RETVAL;}
SAKryukov:我没有时间来测试此代码,但整理了这一点的方法是这样的:赶上了一个非常栈帧的顶部所有的异常,并分析异常时捕获的信息。找出在哪一行抛出异常。机会是,一些方法/属性没有实现在Mozilla。避免使用一个解决这种不兼容的方法/属性,使用标准方法/属性,通常是可能的。

此外,JavaScript调试器下运行。如果您使用Visual Studio,这是很容易做到。

不完整的解决方案很抱歉,但我希望你可以按自己出来。

mdash;的SA
评论会员:游客 时间:2012/02/07
Dorababu743:尝试为您所需的改变这种{A}工作演示{A2}检查这太{A3的}]
koolprasad2003
评论会员:游客 时间:2012/02/07
的innerTextMozila,使用不支持的innerHTML代替。|