Using the innerText Property in Firefox
来源:互联网 发布:重庆巨鸟网络 编辑:程序博客网 时间:2024/04/28 07:38
I’ve read on different forums questions of people asking how they can make the innerText property work in Firefox. Many have suggested to use the innerHTML property instead, but that would not be useful because, obviously, the HTML tags would be either rendered or displayed (an example of the latter would be if we want such text to be displayed in a textarea or text field) giving undesired effects.
Well, in short, Firefox does not support the innerText property. Instead, it supports the textContent property.
So, you could ’sniff’ what browser the user is using and use the correct property accordingly.So, you could check for the browser’s feature support to use the correct property accordingly (this is better than sniffing ;))
Example (updated):
if(document.all){document.getElementById('element').innerText = "my text";} else{document.getElementById('element').textContent = "my text";}
That’s it. Hope it helps
- Using the innerText Property in Firefox
- Why is .innerText not working in Firefox?
- firefox 下 'innerText' works in IE, but not in Firefox
- Using Property Grid in C#
- Using the java.rmi.server.codebase Property
- firefox不支持innerText
- firefox不支持innerText
- firefox innerText 实现
- 转:FireFox支持innerText
- firefox add innerText support
- 【坑】Firefox不支持innerText
- invoking an exe using javascript in firefox
- the investors buy the property in question.
- Using the Flexgrid in VC++
- Using ODBC in the core
- innerText在FireFox下无效。
- 关于firefox怎么实现innerText
- firefox 中 innerText,innerHTML,textContent,
- 什么是句柄?
- 关于Linq中的IN和Like用法
- 简易摘
- .net中的DateTime.ToString()方法中的时间格式
- 谈局域网安全
- Using the innerText Property in Firefox
- 网络字节序和主机字节序
- cookies不能保存
- 网页中LRC歌词同步显示
- SQL Server 2005 查看引用特定表的存储过程
- DOS内部命令和批处理命令列表
- 索尼CEO:已走出谷底 发誓夺回电子巨头宝座
- 微软推Hyper-V服务器虚拟化软件 叫板VMware
- 2008-06-30 12:51:19 [日志信息] could not initialize proxy - the owning Session was closed