duandianwen1723 2015-07-20 09:32
浏览 25
已采纳

在我的页面上嵌入电源点演示文稿

In my case,on the client side the user can select (img(jpg|png|gif") file,pdf file,ppt file) and the data is getting stored in the database.Now in admin pannel i have to show this selected files.what i have done is I am using a if condition if file is img than i am using img tag (src =folder containg file /database value ) and for pdf i am using anchor tag hyperlink (href = folder containg file /database value) both are working fine but the problem is with ppt file i did the same as i did for pdf but it is directly downloading the file and i want to show the file only. I don't know how to this i searched for the plugin also , i am not getting anything. I tried to use the iframe and (src =folder containg file /database value )
This is also not working its directly downloading the file

  • 写回答

1条回答 默认 最新

  • doujionggan9570 2015-07-20 09:39
    关注

    you can use Google Doc viewer for that. It handles all kind of files : jpg, gif, png, doc, docx, xls, xlsx, ppt, pptx, etc...

    Download and include jQuery in your scripts: <script type="text/javascript" src="./js/jquery-1.11.3.min.js"></script>

    Create an empty container for your preview : <div id='previewContainer'></div>

    You can display it on clicking on a button for ex : <button class="fileClic" data-file="THE_URL_OF_YOUR_DOC">Display</button> Then a little script to embed the google document iframe :

    $('.fileClic').on('click', function (e) {
        e.preventDefault();
    
    var file = $(this).data('file'); // the url of the file you want to preview
    
    $('#previewContainer').html('<iframe src="http://docs.google.com/viewer?url='+file+'&#038;embedded=true" width="400" height="400" style="border: none;"></iframe>') 
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?