如何打印IFRAME中的内容
2006-11-15 11:00
447 查看
Here's a quick little tip that demonstrates how to print the contents of an IFRAME from the parent window using JavaScript. I've seen on several discussion forums that this isn't possible when it is. The key item to notice is that we set focus() to the IFRAME just before issuing the print() method.
Please take a moment to rate this tip: http://www.turnkeytools.com/polls/default.asp?POLLID=10000086&DOMAINID=4610
<script language=JavaScript>
function CheckIsIE()
{
if (navigator.appName.toUpperCase() == 'MICROSOFT
INTERNET EXPLORER') { return true;}
else { return false; }
}
function PrintThisPage()
{
if (CheckIsIE() == true)
{
document.ifWorkspace.focus();
document.ifWorkspace.print();
}
else
{
window.frames['ifWorkspace'].focus();
window.frames['ifWorkspace'].print();
}
}
</script>
In the parent window, just put a link or button to call the PrintThisPage() method:
<a href="javascript:PrintThisPage();" >Print This Page</a>
Please take a moment to rate this tip: http://www.turnkeytools.com/polls/default.asp?POLLID=10000086&DOMAINID=4610
<script language=JavaScript>
function CheckIsIE()
{
if (navigator.appName.toUpperCase() == 'MICROSOFT
INTERNET EXPLORER') { return true;}
else { return false; }
}
function PrintThisPage()
{
if (CheckIsIE() == true)
{
document.ifWorkspace.focus();
document.ifWorkspace.print();
}
else
{
window.frames['ifWorkspace'].focus();
window.frames['ifWorkspace'].print();
}
}
</script>
In the parent window, just put a link or button to call the PrintThisPage() method:
<a href="javascript:PrintThisPage();" >Print This Page</a>
相关文章推荐
- ·如何抓取网页数据(抓取网页iframe的数据)·打印iframe的内容
- 如何打印IFRAME中的内容
- 如何使IFrame的长宽与内容自动适应大小
- 如何使IFrame的长宽与内容自动适应大小
- 关于web打印中,只对iframe内容进行预览打印的问题
- C#如何打印RichTextBox控件的内容
- 如何使IFrame的长宽与内容自动适应大小
- 如何去掉打印网页时自带的网址以及页码等内容
- ExtJS中更新html内容以及iframe中内容打印
- 如何让iframe自动适应内容高度
- 如何截取iframe的内容,修改他的CSS
- js打印Iframe中的内容,并且不需要预览。
- 如何使IFrame的长宽与内容自动适应大小
- 如何打印Java异常的完整堆栈内容
- java里如何实现循环打印出字符或字符数组里的内容
- 如何调整一个 IFrame 到其内容的大小不显示滚动条[微软帮助]
- 如何通过iframe调用其他页面的内容
- 如何将Panel里的内容全部旋转90度后打印?
- 使用JavaScript打印iframe内容的方法
- 如何使用javascript打印网页内容