适配IE与火狐

来源:互联网 发布:矩阵的卷积怎么算 编辑:程序博客网 时间:2024/05/12 08:49
var item_usericon1 = document.getElementById("item_usericon1");
  var photoPath=document.getElementById("photo").value;
  if (document.all) {//IE
   $("#preview").remove();
   if(photoPath=="" || photoPath =="null"){
       item_usericon1.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = "<%=request.getContextPath()%>/images/default/user_photo_01.png";
    }
    else{    
      item_usericon1.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = "<%=request.getContextPath()%>/image/imageAction_image.action?fileId="+photoPath+"" ;
  
    }
   item_usericon1.style.width = "145px";
     item_usericon1.style.height = "145px";
  }else{//火狐
   if (photoPath == "") {
     $("#preview").attr("src", "<%=request.getContextPath()%>/images/default/user_photo_01.png");
    }
    else {
   
     $("#preview").attr("src", "<%=request.getContextPath()%>/image/imageAction_image.action?fileId=" + photoPath);
    }
   $("#item_usericon1").removeAttr("style");
    $("#preview")[0].style.width = "144px";
    $("#preview")[0].style.height = "145px";
   }
原创粉丝点击