...

View Full Version : Problems with Printing and Popups IE9 FF8



Tim@DIM
03-26-2012, 09:49 PM
Hello.

Im trying to put in a Popup printer-friendly page on my site.

the Popup works great in Chrome and FireFox. It even works in IE - except im getting a black bg instead of the white i get in the other browsers.

Also the print command is not working in Firefox or IE.

Im running FireFox 8 and IE 9.

heres the code for the Popup:



<script language="javascript" type="text/javascript">
<!--
function popitup(url) {
newwindow=window.open(url,'name','height=200,width=150');
if (window.focus) {newwindow.focus()}
return false;
}

// -->
</script>
</head>
<div>
<img src="IMAGES/BidsCouponSmall-text.png" />
<br />
<br />
<a href="printcoupon.htm" target="coupon"
onclick="window.open('printcoupon.htm','coupon','height=500,
width=400,toolbar=no,directories=no,status=no,
menubar=no,scrollbars=no,resizable=no'); return false;"
>Click HERE To Print</a>
<br />
</div>


To avoid cluttering of this post, the page im having printing problems with can be found here:
http://bidsservice.net/printcoupon.htm

its all html, css, and JS. no server-side code.

Old Pedant
03-27-2012, 12:56 AM
Okay, you are getting the black background because MSIE doesn't like your <body bgcolor="#FFF". Try #FFFFFF instead. Or, better, use style instead of obsolescent bgcolor. Or, even simpler, omit it entirely, since the defautl background color *IS* white.

You are working *WAY* too hard on the printing of that coupon. There is no reason to pop uo yet a third window. Just use CSS to hide all except the coupon itself when printing.

Example:


<style type="text/css">
@media print {
* { display: none; }
div#print_content { display: block; }
}
</style>

Now, when the page is printed, everything except your <div id="print_content"> will not be displayed and hence not printed.

And now your print button can just be


<input type="button" value="Print" onclick="document.print();"/>

Old Pedant
03-27-2012, 01:12 AM
Okay, it wasn't quite as simple as that.

But here. This worked:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Clinet side printer version</title>
<style type="text/css">
* { background-color: white; }

.style1 {color: #0033FF}
.style3 {
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
}

@media print {
h2, table, center, p { display: none; }
div#print_content, div#print_content img { display: block; }
}
</style>
</head>
<body>
<h2 align="center">Print This Coupon</h2>

<h2 align="center">Present This Coupon At Time Of Service</h2>

<div id="print_content" style="text-align: center;"><img src="http://bidsservice.net/IMAGES/BidsCoupon-text.png" /></div>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
Bid's Service Inc | 11276 10 mile rd. warren, mi 48083 | (586) 759-3040
<br />
site by detroit internet media and Detroit Internet Marketing | &copy; 2012
</td>
</tr>
</table>
<br />
<center><input type="button" onclick="window.print();" value="Click here to print Coupon"/></center>
<br />
<br />
<p style="font-size:12px" align="center"><a href="printproblems.html">Having Problems? Click HERE</a></p>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum