window open style using css

<html>
<body>
<script>
function test(){
var win = window.open('','printwindow');
win.document.write('<html><head><title>Print it!</title><link href="styles.css" rel="stylesheet" 

type="text/css"></link></head><body>');
console.log($("#content").html());
win.document.write($("#content").html());
win.document.write('</body></html>');
win.print();
win.close();
}
</script>
<button onclick="test()">Open window</button>
<textarea id="content"><h1>hello</h1></textarea>
</body>
</html>
Reference:http://stackoverflow.com/questions/21224676/window-open-style-using-css

Comments

Popular posts from this blog

How to write data into a excel file using vbscript

Format date as yyyy-mm-dd using vbscript