In my Javascript code, I have the following line:
document.write('<style type="text/css">@import "style_mobile.css";</style>');
Netbeans seems to hate this, and gives me an error message that says:
XHTML element "style" not allowed as XHTML element "script" in this context.
Just to see if it would make a difference, I changed the line to use double quotes on the outside:
document.write("<style type=\"text/css\">@import \"style_mobile.css\";</style>");
Which only succeeded in changing the error to this warning:
Open quote is expected for attribute "{1}" associated with an element "type"
As far as I can tell, neither single nor double quotes impacts the fact that the code works, so I'm not sure why Netbeans is making an issue of it. I could ignore Netbeans' warnings, but I'm aspiring to have my code as clean and standards compliant as possible. There are lines similar to the above throughout my code, and Having all the yellow and red markers is an eyesore.
My current doc type is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
What would be the right format for the document.write
function so that it acheives what I'm trying to do but does so without Netbeans throwing warnings and errors at me? Or is the code legitimate, in which case is there a way I can tell Netbeans to leave me alone?