pdf,图片或文本文件未显示在同一页面的iframe中 [英] pdf, image or text files are not showing on iframe in same page

查看:195
本文介绍了pdf,图片或文本文件未显示在同一页面的iframe中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP MVC框架中作为一个新的公司工作。我有一个页面,我动态添加链接按钮和图标,并有一个静态隐藏的iframe控件。当我点击我的链接按钮或我的php页面上的图标时,它将在新窗口中播种,但不会在同一窗口的iframe中播种。

如何在同一页面中显示它们?



我的JavaScript用于获取文本,pdf或其他任何内容doc文件作为元素:



< script type =  < span class =code-string> text / javascript> 
function reply_clicktext(clicked_id)
{
var myScript = < span class =code-sdkkeyword> document .getElementById(clicked_id);
var myScriptSrc = myScript.getAttribute(' href属性);
var doc = document .getElementById(' myframe');
// alert(name);
// $(视频).attr('src',name);
doc.src = myScript + ' embedded = true';
doc.style.display = block;
// video.load();
// video.play();
// video.height = 400;
// 警报(myScriptSrc);
// alert(clicked_id);
}
< / script>





我的iframe HTML代码是:

 <   iframe     id   =  myframe    style   = 显示:none    width   =  630    height   =  420 >  <   / iframe  >  





我调用该函数的PHP代码reply_clicktext(clicked_id)是:

 <   div      =  fileIcon  >  <   a     id     = <?php echo  myid       $ counter;     > onClick =reply_clicktext(this .id)rel =galleryhref =<? php  echo  $ file-> getDownloadUrl()。  $ mime  ?> & inline = 1> <   img     src   = <?php echo $ file-> getTypeIconUrl()?>    title   = <?php echo $ file-> getObjectName()?>    alt   = <?php echo $ file-> getTypeString()?>    /  >  <   / a  >  <   / div  >  

解决方案

(视频).attr('src',name);
doc.src = myScript + ' embedded = true';
doc.style.display = block;
// video.load();
// video.play();
// video.height = 400;
// 警报(myScriptSrc);
// alert(clicked_id);
}
< / script>





我的iframe HTML代码是:

 <   iframe     id   =  myframe    style   = 显示:none    width   =  630    height   =  420 >  <   / iframe  >  





我调用该函数的PHP代码reply_clicktext(clicked_id)是:

 <   div      =  fileIcon  >  <   a     id     = <?php echo  myid       


counter; > onClick =reply_clicktext(this.id)rel =galleryhref =<? php echo


file-> getDownloadUrl()。


I am working in PHP MVC framework as a new commer. I have a page where I am adding link button and icon dynamically and there is an iframe control which is hidden statically. When I am clicking in my link button or in the icon on my php page it is sowing in new window but not in same window''s iframe.
How can I show them in same page ?

My JavaScript for getting text, pdf or any other doc files as element:

<script type="text/javascript">
            function reply_clicktext(clicked_id)
            {
                var myScript = document.getElementById(clicked_id);
                var myScriptSrc = myScript.getAttribute('href');
                var doc = document.getElementById('myframe');
                //alert(name);
                //$(video).attr('src', name);
                doc.src = myScript+'embedded=true';
                doc.style.display="block";
                //video.load();
                //video.play();
                //video.height =400;
                //alert(myScriptSrc); 
                //alert(clicked_id);
            }
        </script>



My Iframe HTML code is :

<iframe id="myframe" style="display:none" width="630" height="420"></iframe>



My PHP code for calling that function reply_clicktext(clicked_id) is:

<div class="fileIcon"><a id ="<?php echo "myid" . $counter; ?>" onClick="reply_clicktext(this.id)" rel="gallery" href="<?php echo $file->getDownloadUrl() . $mime ?>&inline=1"><img src="<?php echo $file->getTypeIconUrl() ?>" title="<?php echo $file->getObjectName() ?>" alt="<?php echo $file->getTypeString() ?>" /></a></div>

解决方案

(video).attr('src', name); doc.src = myScript+'embedded=true'; doc.style.display="block"; //video.load(); //video.play(); //video.height =400; //alert(myScriptSrc); //alert(clicked_id); } </script>



My Iframe HTML code is :

<iframe id="myframe" style="display:none" width="630" height="420"></iframe>



My PHP code for calling that function reply_clicktext(clicked_id) is:

<div class="fileIcon"><a id ="<?php echo "myid" . 


counter; ?>" onClick="reply_clicktext(this.id)" rel="gallery" href="<?php echo


file->getDownloadUrl() .


这篇关于pdf,图片或文本文件未显示在同一页面的iframe中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆