Java脚本无法在Mozila中运行,但可以在IE中运行 [英] Java Script not working in Mozila but working in IE

查看:68
本文介绍了Java脚本无法在Mozila中运行,但可以在IE中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

请检查下面的代码,使其在IE中正常工作,但在Mozila中不工作.

场景是我的复选框列表lidt来自后面的代码数据绑定.
如果用户选择列表的第一项,则他将无法选择其他任何项,而其他项将消失.现在,如果用户选择其他任何选项,则ha不能选择第一个,它将自动被禁用.

而且,当用户取消选中复选框时,将启用全部隐藏.

我已经完成了它,并且正在IE中工作,请告诉我要使它在Mozila和其他地方也可以工作.

等待快速回复!

代码如下:

Hi all,

Please check the code below it''s working properly in IE but not working in Mozila.

The scenario is that my checkboxlist lidt databound from code behind.
If user selects the first item of the list he is not able to select any other and others will disbaled. Now if user selects any other, ha can not select the first, it will be disabled automatically.

And as and when user uncheck the checkboxes it enables the disbaled all.

I have done it and it;s working in IE please tell me that what i have to do to make it work in Mozila and others also.

A fast reply is awaited!

The code is as :

//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中运行需要任何更改. ...........


任何可以帮助我的人. ........ 先谢谢. ..........

任何人都可以帮助我. ......


好吧,有人不知道该怎么做吗? ??????????
任何人都可以帮助我,对此代码感到非常沮丧.确实需要.我不喜欢JavaScript.因为它不是一种标准语言,所以无论我如何编写上述代码,它都可以在IE中工作,但不能在Mozila中工作.请尝试解决此问题.

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

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


???

请帮忙!!!!!!!!!!!!


???我不了解Firebug,请解决此问题?????????


任何人都可以帮助我,如何在mozila的列表框中找到所有项目?然后检查其已检查的属性?
请HELPPPPPPPPPPP !!!!!!!!!!!!!!! 11




Please check the code is there any change required to run it in Mozila............


Any one who can help me please.........Thanx in advance...........

Any one please help me................


Ok any one don''t know how to make it???????????
I am totally frustated with this code any guy please help. It''s really needed. I don''t like JavaScript. Because of it''s not a standard language, any how i was able to write the above code and it''s working in IE but not in Mozila. Please try to solve this issue.

Please make it solve!!!!!!!!!!!!
?????????????????????????????

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


???

Please help!!!!!!!!!!!!


??? I am not aware of Firebug please make it solve?????????


Any one please help me how can i find the total items in listbox in mozila? AND THEN CHECK FOR IT''S CHECKED PROPERTY?
PLEASE HELPPPPPPPPPPP!!!!!!!!!!!!!!!11

Any one please help me how can i find the total items in listbox in mozila? AND THEN CHECK FOR IT'S CHECKED PROPERTY?
PLEASE HELPPPPPPPPPPP!!!!!!!!!!!!!!!11

推荐答案

我没有时间要测试此代码,但整理方法是:在堆栈框架的最顶部捕获所有异常,并在捕获时分析异常信息.找出在哪一行抛出异常.可能是某些方法/属性未在Mozilla中实现.通过仅使用标准方法/属性的变通方法来避免使用这种不兼容的方法/属性,这通常是可能的.

或者,在JavaScript调试器下运行它.如果您使用Visual Studio,这很容易做到.

很抱歉,您的解决方案不完整,但希望您自己解决.

—SA
I don''t have time to test this code, but the method of sorting this out is this: catch all exceptions on a very top of stack frame and analyze exception information when caught. Find out in which line the exception is thrown. Chances are, some method/property is not implemented in Mozilla. Avoid using this incompatible method/property through a work-around using only the standard methods/properties, which is usually possible.

Alternatively, run it under JavaScript debugger. If you use Visual Studio, it''s easy to do.

Sorry for incomplete solution, but I hope you can sort it out by yourself.

—SA


尝试根据您的要求进行更改

http://viralpatel.net/blogs/2010/11/multiple-checkbox-select-deselect-jquery-tutorial-example.html [ http://viralpatel.net/blogs/demo/jquery/multiple-checkbox-select-deselect/jquery-select-multiple-checkbox.html [ http://www.dotnetcurry.com/ShowArticle.aspx?ID=236 [ ^ ]
Try this by changing as per your required

http://viralpatel.net/blogs/2010/11/multiple-checkbox-select-deselect-jquery-tutorial-example.html[^]

Demo of working

http://viralpatel.net/blogs/demo/jquery/multiple-checkbox-select-deselect/jquery-select-multiple-checkbox.html[^]

check this too

http://www.dotnetcurry.com/ShowArticle.aspx?ID=236[^]


.innerText ,请改用 .innerHTML .


这篇关于Java脚本无法在Mozila中运行,但可以在IE中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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