We help IT Professionals succeed at work.
Get Started

My JavaScript print button script fails on images and IE 6.

mrcoulson asked
Last Modified: 2013-12-08
I have this script (shown below) which I use to build printer-friendly versions of some pages with a button click.  It works well everywhere, except in IE 6 where it hangs when trying to build a page with an image.  IE 6 with just text: no sweat.  Add an image: big sweat.  See in in action (or inaction): http://www.co.frederick.va.us/voter_registrar/voting_machine_instructions.aspx.
function printContent(printThis)
	// This line defines the pop-up window.  You can change these attributes.
	var a = window.open('','','width=600,height=600,scrollbars=yes,resizable=yes,');
	a.document.write("<link rel=\"stylesheet\" href=\"http://www.co.frederick.va.us/dry_dock/css/fredCoStyles.css\" type=\"text/css\" />");
	a.document.write("body{background-image:none !important;}");
	a.document.write(".trOdd {background-color:#9eb3d2;}");
	a.document.write(".trEven {background-color:#FFFFFF;}");
	a.document.write("th {font-size:17px;background-color:#CCCCCC;}");
	a.document.write("#footer {top:1700px !important;}");
	a.document.write("<hr />");
	a.document.write("<p class=\"pageText\"><span style=\"font-size:21px;font-weight:bold;\">County of Frederick, Voter Registration</span><br />");
	// If you are not HR, edit your department's contact info.  Just be sure to esacpe all " with a \.
	a.document.write("107 North Kent Street<br />Winchester, VA 22601</p>");
	a.document.write("<p class=\"pageText\">Phone: (540) 665-5660<br />Email: fcvotes@co.frederick.va.us</p>");
	// The line below can be uncommented and used for a tag line at the bottom of the page.
	// a.document.write("<p class=\"pageText\" style=\"font-style:italic;\">Frederick County is proud to be an Equal Opportunity Employer.</p>");

Open in new window

Watch Question
IT Expert
Top Expert 2009
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE