Monday, April 03, 2006

how to make innerText work in Mozilla/Netscape suite

if(typeof HTMLElement!="undefined"){
HTMLElement.prototype.innerText getter = function(){
var tmp = this.innerHTML.replace(/
/gi,"\n");
return tmp.replace(/<[^>]+>/g,"");
}

HTMLElement.prototype.innerText setter = function(txtStr){
var parsedText = document.createTextNode(txtStr);
this.innerHTML = "";
this.appendChild( parsedText );
}
}

Just place the above in ur java script.

0 Comments:

Post a Comment

<< Home