Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Printing works sometimes and sometimes not!


Message #1 by "Premjit Mazumdar" <premjit@p...> on Wed, 19 Jun 2002 08:08:30
Tnanks for your help Joe and yes, it is an error. Unfortunately correcting 
it doesn't seem to solve the problem, sadly. Thanks again, Maz


> > Can't see anything wrong except shouldn't:
 >  printWindow.window.print();
b> e:
 >  printWindow.print();
?> 
J> oe

> 
>> From: "Premjit Mazumdar" <premjit@p...>
>> Reply-To: "javascript" <javascript@p...>
>> To: "javascript" <javascript@p...>
>> Subject: [javascript] Re: Printing works sometimes and sometimes not!
>> Date: Wed, 19 Jun 2002 08:30:30
>> 
>> Apologies: I left of the declaration of the printWindow variable of 
c> ourse!
>> Maz
>> 
>> 
>>  > Hi, I have a problem with the following cut-down version of a 
function.
>> If
>> I>  leave in the printWindow.close() line at the bottom, I find that the
>> f> irst time a user calls this function, even if the window contains 
more
>> t> han one page of text, only one page is printed. On subsequent calls, 
it
>> m> ay well be that all the pages are printed. I can't understand this
>> b> ehaviour - cannot see anything wrong with the code or any logical
>> s> equence to these events.
>> 
>>  > Can anyone help please!
>> 
>>  > Thanks,
>> 
>>  > Maz
>> 
>>  >
>> 	> function printBulletin()
>> 	> {
>> 	> 	var sText="";
>> 	> 	var printWindow;
>> 	> 	var bprintingConfirmed = confirmPrint("bulletin");
>> 
>>  > 		if (bprintingConfirmed == "true")
>> 	> 	{
>> 
>>  > 			// ..collect text code here and assign to sText...
>> 	> 		printWindow = window.open
>> 
(> 
> '', 'PrintBulletin', 'height=400,width=700,scrollbars=yes,status=yes,too
>> lb
>> a> r=no,menubar=yes,location=no,left=50,top=50');
>> 	> 		printWindow.document.open();
>> 	> 		printWindow.focus();
>> 	> 		printWindow.document.write(sText);
>> 	> 		printWindow.document.write('</DIV></BODY></HTML>');
>> 	> 		printWindow.document.close();
>> 	> 		printWindow.window.print();
>> 
>>  > 			//printWindow.close(); omitted as sometimes only
>> o> ne page is printed; subsequent prints work though!
>> 	> 		printWindow.alert("You may now close this window
>> i> f you wish.");
>> 	>
>> 
>>  >
>> 	> 	}
>> 	> }
>> 
>>  >
>> 
>> ---
>> 
>> Improve your web design skills with these new books from Glasshaus.
>> 
>> Usable Web Menus
>> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
>> r-20
>> Constructing Accessible Web Sites
>> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
>> r-20
>> Practical JavaScript for the Usable Web
>> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
>> r-20
>> ---
>> Change your mail options at http://p2p.wrox.com/manager.asp or
>> to unsubscribe send a blank email to 

> 

> 
_> ________________________________________________________________
J> oin the world?s largest e-mail service with MSN Hotmail. 
h> ttp://www.hotmail.com

> Tnanks for your help Joe and yes, it is an error. Unfortunately 
correcting 
i> t doesn't seem to solve the problem, sadly. Thanks again, Maz

  Return to Index