• FireFox支持innerText的方法


     1 function isIE(){ //ie? 
     2 if (window.navigator.userAgent.toLowerCase().indexOf("msie")>=1) 
     3     return true; 
     4 else 
     5     return false; 
     6 } 
     7 
     8 if(!isIE()){ //firefox innerText define
     9     HTMLElement.prototype.__defineGetter__("innerText", 
    10     function(){
    11         var anyString = "";
    12         var childS = this.childNodes;
    13         for(var i=0; i<childS.length; i++) { 
    14             if(childS[i].nodeType==1)
    15                 //anyString += childS[i].tagName=="BR" ? "\n" : childS[i].innerText;
    16                 anyString += childS[i].innerText;
    17             else if(childS[i].nodeType==3)
    18                 anyString += childS[i].nodeValue;
    19         }
    20         return anyString;
    21     } 
    22     ); 
    23     HTMLElement.prototype.__defineSetter__("innerText", 
    24     function(sText){
    25         this.textContent=sText; 
    26     } 
    27     ); 
    28 }
  • 相关阅读:
    CSU oj 2092-Space Golf
    (全国多校重现赛一)F-Senior Pan
    URAL 1152 False Mirrors
    Codeforces D
    URAL 1635 Mnemonics and Palindromes
    URAL
    Codeforces 912E
    Codeforces 911E
    Codeforces 294D
    Codeforces 448E
  • 原文地址:https://www.cnblogs.com/dtdxrk/p/2782782.html
Copyright © 2020-2023  润新知