I have to print out a div
which I'm doing in the following way:
function PrintElem(elem)
{
Popup(elem.html());
}
function Popup(data)
{
var mywindow = window.open('', 'to print', 'height=600,width=800');
mywindow.document.write('<html><head><title></title>');
mywindow.document.write('<link rel="stylesheet" href="css/mycss.css" type="text/css" />');
mywindow.document.write('</head><body >');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
mywindow.print();
mywindow.close();
return true;
}
My problem is that on IE, when I click the button nothing happens. However, on Chrome and Firefox it works. What can I do to print it out correctly?
EDIT: I'm call print
in the following way:
$('#print_it').click(function(){
var element = $('#itinerario');
PrintElem(element);
});
This is where print_it
is the id of the button.
Another thing I've seen is that after a period of time, Chrome along with other browsers tells me that the page isn't responding. Why is this happening?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…