在IE里打开,编辑,浏览PPT的简单方法
由于项目需要,需要在IE里打开,编辑,查看ppt.现在已经实现,本人把该代码共享出来,希望对有需要的朋友可以借鉴改进.如果你有更好的方法,也谢谢你不忘通知我一声! 首先新建一个打开ppt的模板页,加入以下js代码: <script language="javascript" type ="text/javascript"> String.prototype.trim = function()//增加一个去掉前后空格的TRIM函数 { return this.replace(/(^\s*)|(\s*$)/g,""); } var fullPath = window.location.href.toString(); var fileNameArr = new Array(); var fileName = ""; fileNameArr = fullPath.split('?'); fileName = fileNameArr[1]; if (fileName == undefined) { alert ("错误:参数格式不正确!\n(参数格式:PowerPoint.aspx?文件名)"); window.opener = null; window.close(); } else { if (fileName.trim() == "") { alert ("错误:参数不能为空!\n(参数格式:PowerPoint.aspx?文件名)"); window.opener = null; window.close(); } else { win=window.open(fileName,"","resizable=yes,scrollbars=no,status=yes,toolbar=0,menubar=1,location=no,fullscreen=0"); win.moveTo(0,0); win.resizeTo(screen.availWidth,screen.availHeight); window.opener=null; window.close(); } } </script>
然后在需要的地方用该格式"PowerPoint.aspx?文件名"调用该模板页,就可以实现!并且不会出现因在ie里打开ppt而出现的下载框.
|