js代码: 复制代码 代码如下: <BR>window.onload = function(){ <BR><div class="code" style="position:relative; padding:0px; margin:0px;"><PRE class=javascript name="code">if(window.navigator.userAgent.toLowerCase().indexOf("msie")==0){ //firefox innerText <BR>HTMLElement.prototype.__defineGetter__( "innerText", <BR>function(){ <BR>var anyString = ""; <BR>var childS = this.childNodes; <BR>for(var i=0; i<childS.length; i++) { <BR>if(childS[i].nodeType==1) <BR>anyString += childS[i].tagName=="BR" ? '\n' : childS[i].textContent; <BR>else if(childS[i].nodeType==3) <BR>anyString += childS[i].nodeValue; <BR>} <BR>return anyString; <BR>} <BR>); <BR>HTMLElement.prototype.__defineSetter__( "innerText", <BR>function(sText){ <BR>this.textContent=sText; <BR>} <BR>); <BR>};var test = document.getElementById("test");<BR> <BR>var innerText_s = test.innerText;<BR> <BR>if( innerText_s == undefined ){<BR> <BR>alert( test.textContent ); // firefox<BR> <BR>}else{ <BR> <BR>alert( test.innerText);<BR> <BR>};<BR> <BR><BR> <BR><BR> <BR>}<BR> <BR><BR> <BR><BR> <BR> 登录后复制 html代码 test1 test2