views:

81

answers:

3

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>
+3  A: 

The window name you're using makes IE sad. Try "BasicModalContent" instead. (The second parameter to "window.open" is what I'm talking about.)

Pointy
Got it - working it now... Cheers!
TraderY
+1  A: 

Here's a link at the function's definition page where someone else reported the 'dash in title' problem. Looks like Pointy's right.

http://msdn.microsoft.com/en-us/library/ms536651%28VS.85%29.aspx#6

Dan
Dan - Pointy: very cool, I'll go and work it right away!Cheers,TY
TraderY
A: 

It worked - the dashes were killing the pass. I renamed the DIV and it works like a charm!

Many thanks to Pointy and Dan!!

TraderY