日期:2014-05-16  浏览次数:20756 次

使用jquery动态调入后台pdf文件,为啥FF行,IE不行? - Web 开发 / Ajax
后台PDF.ashx
<%@ WebHandler Language="C#" Class="PDF" %>

using System;
using System.Web;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;

public class PDF : IHttpHandler {
   
  public void ProcessRequest (HttpContext context) {
  context.Response.ContentType = "text/plain";
  string htmlstr;
  htmlstr="<object classid=\"clsid:CA8A9780-280D-11CF-A24D-444553540000\" width=\"860\" height=\"811\" border=\"0\">"+  
"<param name=\"toolbar\" value=\"false\">"+
  "<param name=\"_Version\" value=\"65539\">"+  
  " <param name=\"_ExtentX\" value=\"20108\"> "+  
  " <param name=\"_ExtentY\" value=\"10866\"> " +  
  " <param name=\"_StockProps\" value=\"0\"> " +  
  " <param name=\"SRC\" value=\"t.pdf\"> "+
"<embed src=\"t.pdf\" width=\"850\" height=\"850\" href=\"t.pdf\"></embed> "+
"</object> ";
  //htmlstr = "<a href=OrderInfo.aspx?id=1&pageindex=2> More</a>";
  context.Response.Write(htmlstr);
  return;
  }
  }
 
  public bool IsReusable {
  get {
  return false;
  }
  }
}

html页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
  <title>无标题页</title>
<script src="js/jquery-1.2.6.js" type="text/javascript"></script>
<script src="js/page.js" type="text/javascript"></script>
<script src="js/data.js" type="text/javascript"></script>
</head>
<body>
<div id="pdf" style=" left:100px; position: absolute;width:800px;height:800px;">

</div>
</body>
</html>

page.js
$(function(){
bind();
}); 

data.js
function bind()
{
$.ajax({
type: "get",
dataType: "html",
url: "PDF.ashx",
data: "method=getpdf" ,
complete :function(){$("#pdf").show();},
success: function(msg){
$("#pdf").append(msg);
//alert(msg);
}
});


------解决方案--------------------
晕,自己解决了