Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to close a popup window *only after* the user prints the screen 1

Status
Not open for further replies.

DotNetter

Programmer
May 19, 2005
194
US
I have a popup window in VB.NET. As soon as it pops-up, it executes a JavaScript "window.print();" How can I close the window (using JavaScript, presumably) only after the user actually prints the screen (i.e. clicks the resulting "print" button")? When I tried to do a "self.close();" immediately after the Window.print, it did not close...

Thanks very much!
Dot
 
Bclt, thanks...

But here's the actual order of execution:
1) Window pops up
2) .net executes "window.print"
3) .net executes "window.close" (I hear an "error" beep when it tries to do that)
4) The print dialog box pops up
5) user clicks print
6) pop-up window sticks around indefinitely...

Any ideas how to get it executing properly?

Thanks!
Dot
 
To do this with least fuss to the user (i.e. warning messages), and maximum cross-browser compatibility, you should use a callback function to the window that opened the popup. The callback function would then close the window.

To do this, you would store a pointer to the window (in your VB code), and from your popup, use "window.opener.callbackFuncName()" to call the function which would use the VB handle to close the popup.

Hmm.. maybe it is "window.opener.document.callbackFuncName()"... anyway - that's the plan!

Hope this helps,
Dan

[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Actually, 100% of my users will be using IE - so (even if it's IE-specific) the simpler, the better!

Thanks,
Dot
 

In which case, try:

Code:
opener = self;
self.close();

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Nope. Same thing still (i.e. same 6 steps are executing, as I mentioned above)...
Dot
 
At you 3rd step have you tried putting "javascript:window.close()" with the double quotes ?
 
I tried it now. Same thing - just no beep anymore. I suspect that's a bad sign - probably means it's not even the right syntax to get it to close...
 
In your first post, you say that JavaScript executes the window.print, and in your second, you say that .net does.

Can you post your code - it's hard to understand from your conflicting information what is axctually happening.

Dan

[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Dan - sorry for the confusion:
Code:
Page.RegisterStartupScript("PrintCalendar", "<script language=""javascript"">" & System.Environment.NewLine & "window.print();" & System.Environment.NewLine & "</script>")

Page.RegisterStartupScript("closeCalendar", "<script language=""javascript"">" & System.Environment.NewLine & "opener = self; self.close();" & System.Environment.NewLine & "</script>")
Thanks very much,
Dot
 

Can you show the client-side script (view source in the browser)?

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Here's the popup window's client-side script:
Code:
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;
&lt;HTML&gt;
	&lt;HEAD&gt;
		&lt;title&gt;MDOnline Calendar&lt;/title&gt;
		&lt;meta content=&quot;Microsoft Visual Studio .NET 7.1&quot; name=&quot;GENERATOR&quot;&gt;
		&lt;meta content=&quot;Visual Basic .NET 7.1&quot; name=&quot;CODE_LANGUAGE&quot;&gt;
		&lt;meta content=&quot;JavaScript&quot; name=&quot;vs_defaultClientScript&quot;&gt;
		&lt;meta content=&quot;[URL unfurl="true"]http://schemas.microsoft.com/intellisense/ie5&quot;[/URL] name=&quot;vs_targetSchema&quot;&gt;
	&lt;/HEAD&gt;
	&lt;body MS_POSITIONING=&quot;FlowLayout&quot;&gt;
		&lt;form name=&quot;Form1&quot; method=&quot;post&quot; action=&quot;PrintCalendar.aspx&quot; id=&quot;Form1&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;__EVENTTARGET&quot; value=&quot;&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;__EVENTARGUMENT&quot; value=&quot;&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;__VIEWSTATE&quot; value=&quot;dDwtMjA3MD long string /M=&quot; /&gt;

&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
&lt;!--
	function __doPostBack(eventTarget, eventArgument) {
		var theform;
		if (window.navigator.appName.toLowerCase().indexOf(&quot;microsoft&quot;) &gt; -1) {
			theform = document.Form1;
		}
		else {
			theform = document.forms[&quot;Form1&quot;];
		}
		theform.__EVENTTARGET.value = eventTarget.split(&quot;$&quot;).join(&quot;:&quot;);
		theform.__EVENTARGUMENT.value = eventArgument;
		theform.submit();
	}
// --&gt;
&lt;/script&gt;

			&lt;p align=&quot;center&quot;&gt;&lt;/p&gt;
			&lt;div id=&quot;pnlPrintCalendar&quot; align=&quot;Center&quot;&gt;
	&lt;table id=&quot;cldPHOEvents&quot; cellspacing=&quot;1&quot; cellpadding=&quot;2&quot; rules=&quot;all&quot; bordercolor=&quot;Black&quot; border=&quot;1&quot; style=&quot;color:Black;background-color:White;border-color:Black;border-width:1px;border-style:Solid;font-family:Verdana;font-size:9pt;height:504px;width:747px;&quot;&gt;
		&lt;tr&gt;&lt;td colspan=&quot;7&quot; style=&quot;background-color:#6666CC;height:12pt;&quot;&gt;&lt;table cellspacing=&quot;0&quot; border=&quot;0&quot; style=&quot;color:White;font-family:Verdana;font-size:12pt;font-weight:bold;width:100%;border-collapse:collapse;&quot;&gt;
			&lt;tr&gt;&lt;td style=&quot;color:White;font-size:8pt;font-weight:bold;width:15%;&quot;&gt;&lt;a href=&quot;javascript:__doPostBack('cldPHOEvents','V1917')&quot; style=&quot;color:White&quot;&gt;Apr&lt;/a&gt;&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;width:70%;&quot;&gt;May 2005&lt;/td&gt;&lt;td align=&quot;Right&quot; style=&quot;color:White;font-size:8pt;font-weight:bold;width:15%;&quot;&gt;&lt;a href=&quot;javascript:__doPostBack('cldPHOEvents','V1978')&quot; style=&quot;color:White&quot;&gt;Jun&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
		&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Sun&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Mon&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Tue&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Wed&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Thu&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Fri&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Sat&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;24&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;25&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;26&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;27&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;28&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;29&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;30&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;1&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;2&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;3&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;4&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;5&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;6&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;7&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;8&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;9&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;10&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;11&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;12&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;13&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;14&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;15&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;16&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;17&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;18&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;19&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;20&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;21&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;22&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;23&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;24&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;25&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;26&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;27&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;28&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;29&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;30&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;31&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;1&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;2&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;3&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;4&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
	&lt;/table&gt;
&lt;/div&gt;&lt;script language=&quot;javascript&quot;&gt;
window.print();
&lt;/script&gt;

&lt;/form&gt;
	&lt;/body&gt;
&lt;/HTML&gt;
 
...or maybe you were asking for the source of the parent page (the one that calls the popup when &quot;Print this month&quot; is clicked...

Here it is:
Code:
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;
&lt;HTML&gt;
	&lt;HEAD&gt;
		&lt;title&gt;PHO Events: Calendar&lt;/title&gt;
		&lt;meta content=&quot;Microsoft Visual Studio .NET 7.1&quot; name=&quot;GENERATOR&quot;&gt;
		&lt;meta content=&quot;Visual Basic .NET 7.1&quot; name=&quot;CODE_LANGUAGE&quot;&gt;
		&lt;meta content=&quot;JavaScript&quot; name=&quot;vs_defaultClientScript&quot;&gt;
		&lt;meta content=&quot;[URL unfurl="true"]http://schemas.microsoft.com/intellisense/ie5&quot;[/URL] name=&quot;vs_targetSchema&quot;&gt;
		&lt;LINK href=&quot;../Styles.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot;&gt;
	&lt;/HEAD&gt;
	&lt;body MS_POSITIONING=&quot;FlowLayout&quot;&gt;
		&lt;script src=&quot;../Common.js&quot;&gt;&lt;/script&gt;
		&lt;script language=&quot;javascript&quot;&gt;GenerateHeader()&lt;/script&gt;
		&lt;form name=&quot;Form1&quot; method=&quot;post&quot; action=&quot;pHoevents.aspx&quot; id=&quot;Form1&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;__EVENTTARGET&quot; value=&quot;&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;__EVENTARGUMENT&quot; value=&quot;&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;__VIEWSTATE&quot; value=&quot;dDwt long string here +CUg==&quot; /&gt;

&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
&lt;!--
	function __doPostBack(eventTarget, eventArgument) {
		var theform;
		if (window.navigator.appName.toLowerCase().indexOf(&quot;microsoft&quot;) &gt; -1) {
			theform = document.Form1;
		}
		else {
			theform = document.forms[&quot;Form1&quot;];
		}
		theform.__EVENTTARGET.value = eventTarget.split(&quot;$&quot;).join(&quot;:&quot;);
		theform.__EVENTARGUMENT.value = eventArgument;
		theform.submit();
	}
// --&gt;
&lt;/script&gt;

			&lt;table cellSpacing=&quot;0&quot; cellPadding=&quot;10&quot; width=&quot;750&quot; align=&quot;center&quot; border=&quot;0&quot;&gt;
				&lt;tr&gt;
					&lt;td vAlign=&quot;top&quot;&gt;&lt;font class=&quot;SubHeadANN11K&quot;&gt;
							&lt;P align=&quot;left&quot;&gt;Advocate Health Partners&lt;BR&gt;
								&lt;FONT face=&quot;Times New Roman&quot;&gt;&lt;FONT class=&quot;HeadANB15K&quot;&gt;PHO Events&lt;/FONT&gt;&lt;BR&gt;
									&lt;FONT class=&quot;HeadANB14O&quot; color=&quot;#000000&quot;&gt;Calendar&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
							&lt;P align=&quot;center&quot;&gt;&lt;FONT face=&quot;Arial&quot;&gt;&lt;EM&gt;To view more detailed information about an event, 
										please click on the event; for more&lt;br&gt;
										detailed information about all events on a given day, please click the date of 
										interest.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
						&lt;/font&gt;
						&lt;P align=&quot;center&quot;&gt;&lt;span id=&quot;lblAddEvent&quot; onclick=&quot;window.open('ChangeEvent.aspx?EventType=Add', 'AddPopUp', 'menubar=yes, resizable=yes, scrollbars=no, toolbar=no, status=no, width=550, height=580')&quot; style=&quot;color:Blue;font-size:Medium;font-weight:bold;text-decoration:underline;CURSOR: hand&quot;&gt;Add event to calendar&lt;/span&gt;&lt;/P&gt;
						&lt;P align=&quot;center&quot;&gt;&lt;span id=&quot;lblPrint&quot; style=&quot;color:Blue;font-size:Medium;font-weight:bold;text-decoration:underline;&quot;&gt;&lt;span style=&quot;cursor:hand&quot; ForeColor=&quot;Blue&quot; onClick=&quot;window.open('PrintCalendar.aspx', 'PrintCalendar', 'width=500, height=500, menubar=no, resizable=yes, scrollbars=yes, toolbar=no, status=no')&quot;&gt;Print this month&lt;/span&gt;&lt;/P&gt;
						&lt;table id=&quot;cldPHOEvents&quot; cellspacing=&quot;1&quot; cellpadding=&quot;2&quot; bordercolor=&quot;Black&quot; border=&quot;0&quot; style=&quot;color:Black;background-color:White;border-color:Black;border-width:1px;border-style:Solid;font-family:Verdana;font-size:9pt;height:504px;width:747px;&quot;&gt;
	&lt;tr&gt;&lt;td colspan=&quot;7&quot; style=&quot;background-color:#6666CC;height:12pt;&quot;&gt;&lt;table cellspacing=&quot;0&quot; border=&quot;0&quot; style=&quot;color:White;font-family:Verdana;font-size:12pt;font-weight:bold;width:100%;border-collapse:collapse;&quot;&gt;
		&lt;tr&gt;&lt;td style=&quot;color:White;font-size:8pt;font-weight:bold;width:15%;&quot;&gt;&lt;a href=&quot;javascript:__doPostBack('cldPHOEvents','V1917')&quot; style=&quot;color:White&quot;&gt;Apr&lt;/a&gt;&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;width:70%;&quot;&gt;May 2005&lt;/td&gt;&lt;td align=&quot;Right&quot; style=&quot;color:White;font-size:8pt;font-weight:bold;width:15%;&quot;&gt;&lt;a href=&quot;javascript:__doPostBack('cldPHOEvents','V1978')&quot; style=&quot;color:White&quot;&gt;Jun&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
	&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Sun&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Mon&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Tue&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Wed&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Thu&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Fri&lt;/td&gt;&lt;td align=&quot;Center&quot; style=&quot;color:#333333;font-size:8pt;font-weight:bold;height:8pt;&quot;&gt;Sat&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;24&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;25&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;26&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;27&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;28&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;29&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;30&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;1&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;2&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;3&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;4&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;5&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;6&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;7&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;8&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;9&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;10&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;11&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;12&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;13&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;14&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;15&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;16&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;17&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;18&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;19&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;20&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;21&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;22&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;23&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;24&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;25&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;26&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;27&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffcc;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;28&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;29&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;30&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;31&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;1&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;2&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;3&lt;/b&gt;&lt;/td&gt;&lt;td align=&quot;Left&quot; valign=&quot;Top&quot; style=&quot;color:Blue;background-color:#CCCCCC;font-size:XX-Small;height:75px;width:14%;background-color:#ffffff;menubar:yes;resizable:yes;scrollbars:yes;toolbar:yes;status:yes;&quot;&gt;&lt;font size=2&gt;&lt;b&gt;4&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/td&gt;
				&lt;/tr&gt;
			&lt;/table&gt;
		&lt;/form&gt;
		&lt;SCRIPT language=&quot;javascript&quot;&gt;GenerateFooter()&lt;/SCRIPT&gt;
	&lt;/body&gt;
&lt;/HTML&gt;
 
This is interesting. If you have change this:

Code:
<script language="javascript">
window.print();
</script>

to this:

Code:
<script language="javascript">
opener = self;
self.close();
</script>

then the window closes itself as soon as it is opened. When you add the printing call back in, the close no longer works. Even if the "onafterprint" event is harnessed, the window stays open. I suspect this is because of the print dialog being open. Unfortunately, I don't know of a way to stop it from appearing.

One thing you could possibly do is to have the close done on a timer... so if the user presses print fairly quickly, this window would close, but if they hung around, they would have to close it themselves.

Hope this helps,
Dan

[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
...a timer doesn't seem to do the trick for this... Thanks for your efforts, Dan...

Any other ideas? Any one? :-(
Dot
 
Wow, this is crazy. This used to work in IE.

This shows the print window, but doesn't close the window:
Code:
<script>
window.print();
opener=self;
window.close();
</script>

This closes the window, but doesn't show the print dialog:
Code:
<script>
window.print();
alert(0);
opener=self;
window.close();
</script>

I tried a timer like Dan said, and that seemed to work:
Code:
<script>
window.print();
setTimeout('opener=self;window.close();',50)
</script>

Adam

¡ph ¥0u c4n r34d d¡5 ¥0u n33d 70 g37 l4¡d
 
DotNetter, try this
use this code in the page you want to print
Code:
 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim Script As New StringBuilder("")
        Script.Append("<script type=""text/javascript""> ")
        Script.Append(System.Environment.NewLine)
        Script.Append("function CloseMe() {")
        Script.Append(System.Environment.NewLine)
        Script.Append(" window.opener = window;")
        Script.Append(System.Environment.NewLine)
        Script.Append("window.close();}")
        Script.Append(System.Environment.NewLine)
        Script.Append("function printPage() { ")
        'Script.Append(System.Environment.NewLine)
        'Script.Append("CloseMe();")
        Script.Append(System.Environment.NewLine)
        Script.Append("window.print();")
        Script.Append(System.Environment.NewLine)
        Script.Append("CloseMe();")
        Script.Append(System.Environment.NewLine)
        Script.Append("} ")
        Script.Append(System.Environment.NewLine)
        Script.Append("</script> ")
        

        Page.RegisterStartupScript("printPage", Script.ToString)
End Sub
in the HTML side you can use an a link to call printpage
Code:
<a href="javascript:printPage()">Print This Page</a>

Tested in IE 6.0

Good luck


What would you attempt to accomplish if you knew you would not fail?
 
eCreations - excellent, excellent, excellent!!!

Thanks so much! (Star!!!)

Alternatively:
Code:
		window.print();
		window.opener = window
		setTimeout("CloseWindow()", 50)	
			}
	}	
	
function CloseWindow()
	{
		window.close();
	}

Thanks so much!
Dot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top