日期:2014-05-18  浏览次数:20458 次

上传图片时单击选中图片IE8显示不了图片
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   
  <object id="uploadid" height="20" width="120" classid="clsid:18B9E4BF-F21F-46B9-AD50-5CA62145426A" style="display:none">
  <param name="Action" value="Upload.aspx" />
  <param name="AllowExt" value="gif;jpg;bmp" />  
  <param name="MaxFileSize" value="5242880" />  
  </object>  
  <style type="text/css">
 
  body {
background-color: #F2F1F3;
  }
   
  body,td,th {
font-size: 14px;
  }
   
  .imgtd {
  width:170px;
  height:130px;
  text-align:center;
  vertical-align:middle;
  }

  </style>
   
  <script type="text/javascript">
  function selectfiles() {
  var str = uploadid.selectfiles();
  if (str != "") {
  showimgs(str);
  document.all.up_load.disabled = false;
  }
  else {
  document.all.up_load.disabled = true;
  }
  }

  function showimgs(urls) {

  var tb = document.getElementById("smallimgs");
  var tr, tcell, timg;
  var imgs = urls.split("\n");
  var i = 0, j = 0;
  while (tb.rows.length > 0) {
  tb.deleteRow(0);
  }

  if (urls == "") {
  showcount.innerHTML = "每张图最大5M";
  return;
  }

  for (i = 0; i < imgs.length; i++) {
  if (i % 4 == 0) {
  tr = tb.insertRow(tb.rows.length);
  for (j = 0; j < 4; j++) {
  tcell = tr.insertCell(j);
  tcell.className = "imgtd";

  tcell.innerHTML = "";
  }
  }

  tcell = tr.cells(i % 4);
  tcell.innerHTML = "<img src=\"" + imgs[i] + "\" style=\"width: 160px; height: 120px\" />";

  }

  showcount.innerHTML = "每张图最大5M, 合计:" + imgs.length + " 张图";

  }

  function upload() // 执行上传操作
  {
  if (confirm("系统提示:\n\n是否确认要上传图片")) {
  uploadid.addformitem("id", document.all.BillNo.value);
  uploadid.addformitem("type", document.all.BillType.value);

  var str = uploadid.uploadfile();
  if (str == "") {
  alert("上传文件成功");
  showimgs("");
  UploadComplete();
  }
  else {
  alert("上传文件失败!" + str);
  }
  document.all.up_load.disabled = true;