解决 Firefox 的 innerText
在做公司的一个项目的时候发现,Firefox 下可以用 obj.innerText 获取指定标签内的文本数据,却无法通过 obj.innerText = str 的方式来填充。在网上搜索了一会找到一段给 Firefox 添加 innerText 填充的 js 代码。
function isIE(){
if(window.navigator.userAgent.toLowerCase().indexOf(“msie”)>=1){
return true;
}else{
return false;
}
}if(!isIE()){
HTMLElement.prototype.__defineGetter__(“innerText”,
function(){
var anyString = “”;
var childS = this.childNodes;for(var i=0; i<childS.length; i++) {
if(childS[i].nodeType==1){
anyString += childS[i].tagName==”BR” ? ‘\n’ : childS[i].innerText;
}else if(childS[i].nodeType==3){
anyString += childS[i].nodeValue;
}
}return anyString;
}
);HTMLElement.prototype.__defineSetter__(“innerText”,
function(sText){
this.textContent=sText;
}
);
}
还记得你发的这个帖子吗?http://wordpress.org.cn/viewthread.php?tid=1126&extra=&highlight=LBS&page=1
我想用LBS的模板,但是传上去了以后网站就打不开了,能不能麻烦你帮忙看看?
另外,你还QQ了?我是落日惊鸿,在QQ上找不到你了。可以话,QQ上请教下~
那还是 WP 2.3 版本的模板了,现在的 WP 都是 2.7 了。改变不少的。以前的模板用不了啦。
Pretty cool post. I just stumbled upon your blog and wanted to say
that I have really liked reading your blog posts. Anyway
I’ll be subscribing to your blog and I hope you post again soon!
路过。