From: Daniel Loose on
Hi!

I have an iframe on my page and a button. When the button is clicked,
a html page containing some text is loaded into the iframe, and I want
the print dialog do be run automatically, in order to print that text.
For that, I have put

window.onload=function() {
parent.iframename.focus();
parent.iframename.print();
}

into the same page containing the text. It works great in IE 7, FF 2,
Opera 9. But it does not in IE 5-6!! Why?? How can I get it to work??
nothing happens at all, not even an error message. Thank you *very*
much!!

Daniel
Marty - it's perfect! You're just not thinking fourth dimensionally!
[Emmett "Doc" Brown]

If you wish to email me, please use newsreply at wuwei minus webservices dot de
From: David Mark on
On Dec 19, 5:35 pm, Daniel Loose <gruenwiesl...(a)web.de> wrote:
> Hi!
>
> I have an iframe on my page and a button. When the button is clicked,
> a html page containing some text is loaded into the iframe, and I want
> the print dialog do be run automatically, in order to print that text.
> For that, I have put
>
> window.onload=function() {
> parent.iframename.focus();
> parent.iframename.print();
>
> }
>

Interesting. I suppose you have an IFrame with an id of
"iframename." I am surprised your code works in anything but IE.
Seems to me that this would work as well:

window.onload = function() {
window.focus();
window.print();
};