ie11浏览器不支持js的remove方法,而支持removeNode方法。移除节点前要判断浏览器的类型;

判断浏览器是否为ie浏览器的方法如下,根据不同的浏览器添加不同的移除方法:

//根据浏览器的不同添加不同的移除方法
function removeNode(){
  if(isIE()||isIE11()){
    obj.parentNode.removeNode(true);
  }else{
     obj.parentNode.remove();
}
function isIE(){ 
  if(!!window.ActiveXObject || "ActiveXObject" in window){
    return true; 
  }else{
    return false;
  } 
}  
function isIE11(){ 
  if((/Trident\/7\./).test(navigator.userAgent)){
    return true;
  }else{
    return false;
  } 
} 

 

相关文章:

  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2021-09-08
猜你喜欢
  • 2021-12-02
  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
  • 2022-12-23
  • 2021-08-15
  • 2021-11-18
相关资源
相似解决方案