废话少说,直接上干货:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(function () { //在线显示Word $("#btn1").click(function () { $("#iframe1").attr("src", "http://view.officeapps.live.com/op/view.aspx?src=http://djk8888.3vdo.net/Doc/1.docx"); }); //在线显示Excel $("#btn2").click(function () { $("#iframe1").attr("src", "http://view.officeapps.live.com/op/view.aspx?src=http://djk8888.3vdo.net/Excel/1.xls"); }); //在线显示PPT $("#btn3").click(function () { $("#iframe1").attr("src", "http://view.officeapps.live.com/op/view.aspx?src=http://djk8888.3vdo.net/PPT/1.pptx"); }); }); </script> </head> <body> <form id="form1" runat="server"> <input type="button" id="btn1" value="在线显示Word" /> <input type="button" id="btn2" value="在线显示Excel" /> <input type="button" id="btn3" value="在线显示PPT" /> <br /> <br /> <div> <iframe id="iframe1" width="800" height="600" frameborder='no' border='0' marginwidth='0' marginheight='0' scrolling='no' allowtransparency='yes' src="http://view.officeapps.live.com/op/view.aspx?src=http://djk8888.3vdo.net/Doc/1.docx"></iframe> </div> <h3>简单说明:</h3> <p> 使用微软提供的Office Online平台只需要一个网址即可在线查看xls,doc,ppt等文档<br /> <a style="color: blue; text-decoration:none;" href="http://view.officeapps.live.com/op/view.aspx" target="_blank"> http://view.officeapps.live.com/op/view.aspx?src=<span style="color: red;">要查看的文档地址</span> </a> </p> <p> <b>本例文档地址:</b><br /> <a>http://djk8888.3vdo.net/Doc/1.docx</a><br /> <a>http://djk8888.3vdo.net/Excel/1.xls</a><br /> <a>http://djk8888.3vdo.net/PPT/1.pptx</a><br /> <a>不用转换成Flash、PDF文件,不需要swf播放器</a> </p> </form> </body> </html>
源码下载:https://download.csdn.net/download/djk8888/10387384
源码下载:https://download.csdn.net/download/djk8888/10387384