General discussion

Locked

How do I print from a pop-up window?

By Judge Dread ·
I want to be able to print from the new window without using the file|print from the menu bar and do it with a link within the new window itself. HERE"S THE CODE:
<!-- Open a NEW window and display the information accepted from the User //-->order=window.open("","orderWindow","toolbar=no,width=550,height=500,menubar=yes,resize=yes,")
with (order.document) {
write("<HTML>")
write("<TITLE>Customer's Rental Invoice-Amount Due!</TITLE>")
write("<HEAD></HEAD>")
write("<BODY BGCOLOR=BLUE>")
write("<H2><FONT COLOR=RED>Thank you for your business, "+custname+"<BR></H2></FONT>")
write("<H4><FONT COLOR=WHITE>Please remember, we will reserve the vehicle of your choice-if you call at least 2 hours in advance.<BR</H3></FONT>")
write("<H4><FONT COLOR=WHITE> Listed below is your address and the total invoice amount of your auto rental. We accept cash, major Credit Cards, and checks drawn on local banks only!<BR></H3></FONT>")
write("<H4><FONT COLOR=YELLOW>Street Address: "+ address+"<BR>")
write("City: "+ city+"<BR>")
write("State: "+ state+"<BR>")
write("Zip Code: "+ zipcode+"<BR>")
write("Customer Type: "+ custype +"<BR>")
write("Beginning Odometer Reading: "+ startodread+"<BR>")
write("Ending Odometer Reading: "+ endodread+"<BR>")
write("Total Miles Driven: "+ totalread+"<br>")
write("Days Rented: "+ daysrented +"<BR>")
write("Total Mileage Charge:$ "+ totmilechg+"<BR>")
write("Total Usage Charge    :$ "+ totdaychg+"<BR><BR>")
write("Total Rental Charge   :$ "+ grandtotal+"<BR><BR>")
write("<a href=\"#\"onClick=\"window.close();\">Close Window</a><BR><BR>")
Write("</BODY>") write("</HTML>")
}
</SCRIPT>


</PRE>
</BODY>
</HTML>

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

How do I print from a pop-up window?

by g_eigo In reply to How do I print from a pop ...

You could use th onload event of the body tag to call either a vbscript or a javascript proceedure to do the print. The body tag will look like this:
<BODY OnLoad="window.print()">

This will cause the print dialog to appear and the user can them print document. There is another way to to do this by using the browser object if the target browser is IE. But since the target browser is unknown I'll mention it and if you need specifics let me know.

Collapse -

How do I print from a pop-up window?

by Judge Dread In reply to How do I print from a pop ...

Poster rated this answer

Collapse -

How do I print from a pop-up window?

by sachinp78 In reply to How do I print from a pop ...

Hi
In the opened child window just call one event
i.e print().
It can be called on body load event
e.g (1)<body onload="javascript:print()"> or

Or you can call
an event window.print() onclick of any gif or link on schild window

Collapse -

How do I print from a pop-up window?

by Judge Dread In reply to How do I print from a pop ...

Poster rated this answer

Collapse -

How do I print from a pop-up window?

by Judge Dread In reply to How do I print from a pop ...

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums