devo stampare un div
che sto facendo nel modo seguente:window.print non funziona in IE
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;
}
mio problema è che su IE, quando si fa clic sul pulsante non accade nulla . Tuttavia, su Chrome e Firefox funziona. Cosa posso fare per stamparlo correttamente?
EDIT: Sono chiamano print
nel seguente modo:
$('#print_it').click(function(){
var element = $('#itinerario');
PrintElem(element);
});
Questo è dove print_it
è l'id del pulsante.
Un'altra cosa che ho visto è che dopo un periodo di tempo, Chrome insieme ad altri browser mi dice che la pagina non risponde. Perché sta succedendo?
possibile DUP di questo: http://stackoverflow.com/questions/2555697/window-print-not-working-in-ie – mpm
non potresti usare 'mywindow.document.innerHTML'? – starbeamrainbowlabs
Dov'è il gestore di eventi per i clic? –