Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Javascript / Client Side Development

The print window is not shown when the page contains an iframe in IE6 (XPsp2)


I want to have the print dialog shown automatically after the the page
is loaded, but when I try to call window.print() BEFORE the iframe,
the print dialog is not shown at all. Anyone can help?

Here is my code:

<html>
        <head>
                <title>Auto print the page</title>
        </head>
        <body>

                ****** The area in my control START *******
                text
                text
                <script type="text/javascript">window.print()</script>
                ****** The area in my control END *******

                other content out of my control
                <iframe src=""></iframe>
        </body>
</html>

Please note:
1. For some reasons <body onload="window.print()"> is not allowed,
it's out of my control
2. The print dialog should be shown without any other action e.g.
click. So onclick="window.print()" is not allowed.
3. The entire page should be printed, so ExecWB(6,1) &
execCommand("Print") are useless, because they only print the content
BEFORE the calling of ExecWB(6,1) or execCommand("Print")
4. The <iframe> should not be removed or changed, it's out of my
control.
5. It works in Firefox

colinzhu said the following on 5/14/2007 11:11 AM:

window.onload = new Function(){window.print()}

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

On May 15, 12:44 am, Randy Webb <HikksNotAtH@aol.com> wrote:

Thanks for your replay, but this method is not allowed also.

I fount a solution today, that is to use:
window.setTimeOut("window.print()", 1) , I don't know why, but it just
works.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc