I can see that you have to have an external stylesheet. Then you can use:
popup.document.write('<html>');
popup.document.write('<head>');
popup.document.write('<title>my popup</title>');
popup.document.write('<link rel="stylesheet" type="text/css" href="mystylesheet.css" />');
popup.document.write('</head>');
.....
Each document.write is a line of html code.
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
I thought you would be using a common stylesheet for all of the pages. If you have control over all of these web pages, you can use a common stylesheet.
Are you trying to find out about stylesheets that other programmers wrote for their own pages?
If so, you are asking for, if not the impossible, the very difficult. It's effectively reverse-engineering the other programmer's page. It's a Brobdingnagian task.
You can't know in advance what the other programmer named his styles, or what he intended to use them for.
You CAN find out the styles applied to a particular web page element, once you know the address index of that element. Use the style methods in JavaScript to find out the style values of the element in question.
e.g. This gets the page's main background color.
[code]
bgco = document.body.backgroundColor;
bgcolor = parseFloat(bgco);
[/quote]
Be aware that this works on only those browsers which use the W3C DOM. Ift fails of an older browser is used to display the page.
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
The innerHTML, innerText, and outerHTML don't work because style sheets aren't html code.
My question is, what are you going to do with the style elements if you do reconstruct them? They won't fit your pages, because you don't have the same class names.
Actually, a larger question arises: Why do you need it? Maybe if I understood what you are really trying to do with this information, I can find a better way.
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
innerHTML, innerText, and outerHTML don't work.
innerHTML certainly works. Providing that you have a valid reference to the
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64