火狐兼容问题 firefox下面没有innerText,但是你可以用textContent属性,你可以写成element.innerText || element.textContent获取文本 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这句怎么写?我javascript不是很熟悉 if("客户管理,员工管理,系统设置".indexOf(tb.innerText.replace(/\n/g, "").replace(/\s/g, "")) > -1)改成什么? 或者实现innerText在页面中加入如下js(function (bool) { 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)); jquery或js实现右侧弹出隐藏内容 如何在非IE浏览器里控制embed的声音播放 js正则问题 弱弱的问一个jscript的问题,帮忙哈 构建留言板 javascript怎么控制一个文本框输入的第一位一定是字母? 简单的问题.请路过大虾进来看看. 问个简单的问题 新点开的窗口中用代码不能设置父窗口中的隐藏域值吗? 緊急問題,我把 select 中的 value 和它后的那個顯示出的文字一起取出來???怎麼樣取。 日期插件 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));