Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
104
rated 0 times [  105] [ 1]  / answers: 1 / hits: 24517  / 11 Years ago, mon, january 20, 2014, 12:00:00

I would like to style my window.open,



I currently have some items on my webpage that open due to a certain class that is parsed, which there after opens the specified text in a new window.



I would like to change the font-size, font and padding etc.



Here is my javascript code.



<script type=text/javascript>
$(.Show a).click(function () {
var html = $(this).parent().next(div.show-dialog).html();
var my_window = window.open(, mywindow1, width=750,height=550);
$(my_window.document).find(body).html(html);

});
</script>


How do I parse css styles in javascript?


More From » html

 Answers
22

Check out this answer: https://stackoverflow.com/a/18758370/1060487



From the answer:



Build a complete HTML page in the opened window and reference your CSS-file there:



var win = window.open('','printwindow');
win.document.write('<html><head><title>Print it!</title><link rel=stylesheet type=text/css href=styles.css></head><body>');
win.document.write($(#content).html());
win.document.write('</body></html>');
win.print();
win.close();

[#73064] Friday, January 17, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
carl

Total Points: 633
Total Questions: 105
Total Answers: 105

Location: Fiji
Member since Wed, Jul 14, 2021
3 Years ago
;