i’m having problem when i want to load css file with document.write() when i check in firebug i get message to
reload the page to get source for common.css
i think that can be solve with reload page, but when i’m reload again the message is same..yeah because my code is like this…
var details = '';
details += '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>';
details += '<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"/> ';
details += '<link type="text/css" href="common.css" rel="stylesheet"/>';
details += '<title>bla..bla..bla..</title>';
details += '</head>';
details += '<body>';
details += '<div id="header">' + '<h1>' + "what do you want" + '</h1></div>';
details += '<div id="content"></div>';
details += '<div id="footer"></div>';
details += '</body>';
details += '</html>';
document.open();
document.write(details);
document.close();
what wrong?
please tell me about this problem , thanks for your answer…
If you want to load a css file with javascript I suggest you create a element and inject it instead of using document.write