js程式碼: 複製程式碼程式碼如下: <>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 insideText <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" : childS[ i].textContent <BR>else if(childS; [i].nodeType==3) <BR>anyString = childS[i].nodeValue; <BR>返回anyString; ); <BR>HTMLElement.prototype.__defineSetter__( "innerText", <BR>function (sText){ <BR>this.textContent=sText; <BR>} <BR>); <BR>};var test = document.getElementById("test");<BR>; var innerText_s = test.innerText; <BR> <BR>if(innerText_s ==未定義){<BR> <BR>alert( test.textContent ); // 火狐<BR>}其他{ <BR > <BR>alert( test.innerText); <BR> <BR>};<BR> <BR><BR> <BR><BR> <BR>}<BR> <BR><BR> <BR> <BR> <BR> 登入後複製 html程式碼 test1;測試2