function showPopup() { var myDiv = document.getElementById('print'); var newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0'); var style = newWindow.document.createElement('link'); style.type = "text/css"; style.rel = "stylesheet"; style.href = "./css/print.css"; style.media = "all"; newWindow.document.write("" + myDiv.innerHTML + ""); newWindow.document.getElementsByTagName("head")[0].appendChild(style); newWindow.document.close(); }