JavaScript中的style.visibility选项问题 [英] style.visibility option issue in JavaScript

查看:133
本文介绍了JavaScript中的style.visibility选项问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部好,



我在申请表中使用以下代码





HI all,

I am using the following code in my application


if (checkbox.value == 0)
        {
        var panel = document.getElementById('ROWID');
        panel.style.visibility = "visible";
        var label= document.getElementById('labelid');
        label.innerText = "Message to be displayed!";
        lblf.style.color = "RED";
        lblf.style.visibility = "visible";
        }







这里我有问题,只有面板可见而不是标签是没有看到这个问题只发生在FIREFOX,而在所有其他问题都得到可见...



任何机构可以让我知道这个问题是怎么回事可以解决。



我也尝试过使用style.display但仍然遇到同样的问题。




Here I have problem that only panel is getting visible but than the label is not getting visible and this problem is only happening in FIREFOX while in all other problems both are getting visible...

Can any body give me idea that how this problem could be solved.

I have also tried using style.display but still getting same issue.

推荐答案

Firefox使用W3C标准 Node :: textContent ,但其行为与MSHTML的专有 innerText <略有不同 br />


所以,更改以下行

Firefox uses W3C standard Node::textContent, but its behavior differs "slightly" from that of MSHTML's proprietary innerText

So, change following line
label.innerText = "Message to be displayed!";



To

if(label.textContent && (typeof (label.textContent) != "undefined") )
   label.textContent = "Message to be displayed!";
else label.innerText = "Message to be displayed!"; 





问候,

Niral Soni



Regards,
Niral Soni


这篇关于JavaScript中的style.visibility选项问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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