<script> <br>window.onload = function(){ <br><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>if(childS[i].nodeType==1) <br>anyString = childS[i].tagName=="BR" ? i].textContent; <br>else if(childS[i].nodeType==3) <br>anyString = childS[i].nodeValue; <br>} <br>return anyString; ); <br>HTMLElement.prototype.__defineSetter__( "innerText", <br>function(sText){ <br>this.textContent=sText; <br>} <br>); <br>};</PRE>var test = document.getElementById("test");<BR> <br>var innerText_s = test.innerText;<BR> <br>if( innerText_s == 정의되지 않음 ){<BR> <br>경고( test.textContent ); // 파이어폭스<br> <br>}else{ <BR> <br>경고( test.innerText);<BR> <br>};<BR> <br><BR> <br><BR> <br>}<BR> <br><BR> <br><BR> <br></script>
html代码
test1 테스트2