JS 浏览器兼容问题

- innerText VS textContent

  FireFox supports textContent, other Browsers supports innerText

  Eg:  

  var divId = document.getElementById('divId');

  if(window.navigator.userAgent.indexOf("Firefox") >= 1){

     alert(divId.textContent);

  } else {

     alert(divId.innerText);

  }

 

你可能感兴趣的:(浏览器,firefox)