firefox下面没有innerText,但是你可以用textContent属性,你可以写成element.innerText || element.textContent获取文本
解决方案 »
- jQuery中断匹配
- 闲谈javascript
- 打印本地word?
- 快疯了,有没有new ActiveXObject("MSXML.DOMDocument");的详细讲解啊?
- 请问怎么动态的删除页面上的文本框啊???急!
- 关闭窗口问题,急死人了,求救!!!!!!
- if(document.layers){ //这句是什么意思?是检测网页中有没有layer存在吗?
- 高分----关于对onclick="javascript:window.open('myasp.asp',null)"过程的几点想法... 请进!
- ligerComboBox设置默认值问题
- href怎么传递js中的变量
- 日期插件 Datepicker 的使用 ???
- 设置下拉列表框的默认值
if("客户管理,员工管理,系统设置".indexOf(tb.innerText.replace(/\n/g, "").replace(/\s/g, "")) > -1)改成什么?
function setInnerText(o, s) {
while (o.childNodes.length != 0) {
o.removeChild(o.childNodes[0]);
} o.appendChild(document.createTextNode(s));
} function getInnerText(o) {
var sRet = ""; for (var i = 0; i < o.childNodes.length; i ++) {
if (o.childNodes[i].childNodes.length != 0) {
sRet += getInnerText(o.childNodes[i]);
} if (o.childNodes[i].nodeValue) {
if (o.currentStyle.display == "block") {
sRet += o.childNodes[i].nodeValue + "\n";
} else {
sRet += o.childNodes[i].nodeValue;
}
}
} return sRet;
} if (bool) {
HTMLElement.prototype.__defineGetter__("currentStyle", function () {
return this.ownerDocument.defaultView.getComputedStyle(this, null);
}); HTMLElement.prototype.__defineGetter__("innerText", function () {
return getInnerText(this);
}) HTMLElement.prototype.__defineSetter__("innerText", function(s) {
setInnerText(this, s);
})
}
})(/Firefox/.test(window.navigator.userAgent));