pdf,图片或文本文件未显示在同一页面的iframe中 [英] pdf, image or text files are not showing on iframe in same page
问题描述
我在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 。
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. 这篇关于pdf,图片或文本文件未显示在同一页面的iframe中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
file-> getDownloadUrl()。
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() .