Marina said:
Hi,
I have a document with an iframe. The main doc has a "Print" button. The
idea is that when the user clicks it, the contents of the iframe is printed.
For some reason instead of the iframe I get a print out of the whole page.
I am using IE6. I spent several hours searching the groups but didn't find
anything that works. Even when I do this:
iframe_name.focus();
window.print();
it still doesn't work.
Thanks in advance for any help.
Marina
<script type="text/javascript">
function PrintIframe()
{
frames["IframeName"].focus();
frames["IframeName"].print();
}
</script>
</head>
<body>
<iframe src="IframeDocument.html" name="IframeName" width="500"
height="200" style="border:3px solid blue;">[Your user agent does not
support iframes or is currently configured not to display iframes. If
you're using Opera 6+, you can enable iframe with
File/Preferences...Alt+P/Page style/Enable inline frames.]</iframe>
<p><button type="button" onclick="PrintIframe();">Print only the
iframe</button></p>
When the user clicks that button, he will then need to select the
"Options" tab of the print modal dialog window. In the Options tab, in
the "Print frames" fieldset, the "Only the selected frame" radio button
will be checked. Click the "Print" button in that Options tab and MSIE 6
will print only the iframe.
Tested, printed and working in MSIE 6 SP2 for Windows; I'll upload the
demo files if needed.
Also tested, printed and working in Netscape 7.1 Compact, K-meleon 0.8
beta build 833 and Mozilla 1.5 final release (though there is an
usability bug in those 3 browsers; the "Print frames" fieldset and "The
selected frame" are disabled when they should not; the requested
printing of the iframe is correct nevertheless).
Tested and NOT working at all in Opera 7.21. I'll file a bug on this.
DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html