Reputation: 124
I have a jsp with multiple div's. I am getting the whole div data using innerHTML
and displaying it to popup window. By using this I'm unable to get all the css styles.
Here is the function:
function popupWin(cs) {
var divText1 = document.getElementById("divId").innerHTML;
var divText2 = document.getElementById("divId"+cs).innerHTML;
var divText3 = document.getElementById("divId"+cs+"abc").innerHTML;
var myWindow = window.open('',"mywindow","status=no,menubar=no,resizable=yes,toolbar=no,scrollbars=yes,addressbar=no,height=600,width=800");
var doc = myWindow.document;
doc.open();
doc.write('<link href="styles/shared/common.css" rel="stylesheet" type="text/css" />');
doc.write('<link href="styles/parent/common.css" rel="stylesheet" type="text/css" media="all" />');
doc.write('<link href="styles/parent/print.css" rel="stylesheet" type="text/css" media="print" />');
doc.write('<link rel="stylesheet" type="text/css" href="styles/admintool.css" />');
doc.write(divText1);
doc.write(divText2);
doc.write(divText3);
doc.close();
}
By using this function only some styles are working.
Upvotes: 0
Views: 1837
Reputation: 19093
Try writing head tags around the style links, and body tags around the content.
Upvotes: 1