Javascript Print Script Not Working in IE

Posted by TY on Stack Overflow See other posts from Stack Overflow or by TY
Published on 2010-04-19T17:33:44Z Indexed on 2010/04/19 18:13 UTC
Read the original article Hit count: 542

Filed under:
|

Greets!

I'm a noob struggling to learn html and javascript - getting there slowly. I'm trying to print a DIV served up by SimpleModal. The page is at:

www.planetsarsfield.com

This "Print" function is in the recipe box at the bottom. Everything works great in FF, but it doesn't work at all in IE8. I must be doing something fundamentally wrong but I can't spot it.

Any ideas?

Cheers, TY ++++++++++++++++++++++++++++++++++++++++++++++++

<script type="text/javascript"> 

function PrintElem(elem) 
{ 
    Popup($(elem).html()); 
} 

function Popup(data)  
{ 
    var mywindow = window.open('', 'basic-modal-content', 'height=400,width=600'); 
    mywindow.document.write('<html><head><title>on the grill... latest recipe</title>');
    mywindow.document.write('<link href="PATH/print.css" rel="stylesheet" type="text/css" />')
    mywindow.document.write('</head><body >'); 
    mywindow.document.write(data); 
    mywindow.document.write('</body></html>'); 
    mywindow.document.close(); 
    mywindow.print(); 
    return true; 
} 

</script>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about simplemodal