I have opened a new window with the code:
w = window.open("", "ventana", "status=1,width=350,height=150");
And there I created a table with
var tresumen = w.document.createElement("table");
and so on, and so on…
Everything works fine, but when it comes to apply CSS, I am finding that the new window is not reading the separate css file that I have referenced from the main html. In the CSS I have some lines for table like this:
table {
some attributes here;
}
The only way I can think about to make the new window read the CSS, is to put a document.write inside the javascript of the new window, putting there the html code to reference (again) the css file, but since it’s already referenced in the main html, I don’t see why that would be a proper way…
What is my mistake here?
How can I make a new window (without its own html!) read the CSS that the main window is using?
Thanks!
Without an actual HTML document loaded or generated inside the new window, you’re relying on browsers’ tag-soup interpretation to make sense of your markup.
That said, you’d have to append a style or link element to that window’s DOM which refers to your external stylesheet.