首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

上传图片时单击选中图片IE8显示不了图片,该怎么处理

2012-04-23 
上传图片时单击选中图片IE8显示不了图片meta http-equivContent-Type contenttext/html charsetut

上传图片时单击选中图片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;
  }
  }

  //刷新获取id
  function UploadComplete() {


  __doPostBack('Refresh', '');
  }

  //设置图片值
  function SetImageValue(idList) {
  var pwin = window.opener;
  if (pwin == null)
  pwin = parent;
  if (top != pwin && pwin.SetImagesId)
  pwin.SetImagesId(idList);
  }

  </script>
   
</head>
<body style="margin:0 0 0 0;">

  <form id="form1" runat="server">
  <div>
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td class="pageHead" style="height:25px; padding-left:8px;">
  <asp:Label ID="Title" runat="server"></asp:Label></td>
  <td class="pageHead" style=" text-align:right; ">
  &nbsp;<span style="display:none"><asp:TextBox ID="BillNo" runat="server"></asp:TextBox><asp:TextBox ID="BillType" runat="server"></asp:TextBox></span>
  <input id="se_files" type="button" value="选择图片" class="btn5_1" onclick="selectfiles()"/>&nbsp;
  <input id="up_load" type="button" value="上传文件" class="btn5_1" disabled="disabled" onclick="upload()"/>&nbsp;</td>
  </tr>
</table>

  <table border="0" cellpadding="0" cellspacing="0" style="width:100%; height:100%">
  <tr>
  <td style=" text-align:center; vertical-align:middle; background-color:#EAEAEA; height:100%">
  <div style="overflow:auto; width:730px; text-align:center; vertical-align:top">
   
  <table border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed" id="smallimgs">
  <tr>
  <td class="imgtd">&nbsp;</td>
  </tr>
  </table>
  </div>
   
  </td>
  </tr>
  <tr>
  <td class="pageHead" style="height:25px; padding-left:8px; text-align:right"><span id="showcount">每张图最大5M</span>&nbsp;</td>
  </tr>
  </table>  

  </div>

  </form>
</body>
</html>


上传图片时单击选中图片IE8显示不了图片,上传我先不想弄先,现在想解决单击选中图片IE8显示图片的问题,求救!

[解决办法]
参见Flash实现的代码
http://www.klstudio.com/post/182.html

热点排行