그림 미리보기 호환 i 구글 Firefox

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 TRANSITIONAL//EN" "HTTP://WWW.W3.ORG/TR/XHTML1/DTD/XHTML1-TRANSITIONAL.DTD">
<!-- saved by WebSaver from url=C:\Documents and Settings\Administrator\ \test\ \testPic.html -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE> </TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type></HEAD>
<BODY ondragstart="" oncontextmenu="" onselectstart=""  onunload=""  onchange="previewImage(this,'img','d')" type=file>
<DIV id='d'    previewImage(file,imgid,divid)
{
    var width = 300;
    var height = 300;
if(/gif|jpg|jpeg|png|bmp/i.test(file.value.match(/\.(\w+)$/)[0])){
     var div = document.getElementById(divid);
  if (file.files && file.files[0])
  {
    div.innerHTML = '<img id='+imgid+'>';
    var img = document.getElementById(imgid);
    img.onload = function(){
      img.width = width;
      img.height = height;
        
    }
    var reader = new FileReader();
    reader.onload = function(evt){img.src = evt.target.result;}
    reader.readAsDataURL(file.files[0]);
    $("#"+divid).show();
  }
  else
  {
    var sFilter='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
    file.select();
    var src = document.selection.createRange().text;
    div.innerHTML = '<img id='+imgid+'>';
    var img = document.getElementById(imgid);
    //img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader'). src;
     div.innerHTML = "<div id=divhead style='width:"+width+"px;height:"+width+"px;"+sFilter+src+"\"'></div>";
    $("#"+divid).show();
  }
    }else{
        alert(" gif,jpg,jpeg,png bmp !");
        obj.outerHTML = obj.outerHTML;
    }
   
}
</script>

좋은 웹페이지 즐겨찾기