Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Lamberti Fabrizio
May 26, 2004, 9:59 pm
rate this thread
I've got this problem.
I've an ASP file, named content.asp, with inside an input button and a
iframe that loads another asp file, named iframe.asp
I'd like printing iframe.asp using the button inside content.asp.
The size of iframe object inside content.asp is smaller than the real size
of iframe.asp so I can't use JSCRIPT code window.print for the input button.
How can I solve my problem ?
Re: window.print and iframe
Assuming you have this markup in your content.asp file:
<p><button type="button" onclick="PrintIframe();">Print the content of
<iframe name="IframeName" src="iframe.asp" ...></iframe>
then in your <head> include this:
1- Note that content.asp and iframe.asp must share the same domain
otherwise you'll be prevented to print because of the scripting across
domain security constraint:
"when loading a document from one origin, a script loaded from a
different origin cannot get or set specific properties of specific
browser and HTML objects in a window or frame"
2- Last time I checked this issue (~ 6 months ago or so), Opera 7.x was
not printing iframe but this could have been fixed since then. The code
works for NS 7.x, Mozilla 1.3+, MSIE 6.
- » submit the form to the server without opening another page
- — Next thread in » HTML Markup Language