Ho una serie di file css che vorrei che venissero letti su ie inferiori a ie5, una serie solo su ie6 ed una serie per tutte le versioni successive. Inoltre vorrei che questi ultimi venissero leggi per tutti gli altri browser degni di nota come opera, netscape, firefox, safari e crome.
Il listato é il seguente; vi riporto solo uno stralcio in quanto quello che c'é dentro é scritto in modo corretto (" -> \").
codice:
<script type="text/javascript">
if (document.all){
document.write("");
document.write("<!--[if lt IE 6]>");
document.write("...");
document.write("<![endif]-->");
document.write("");
document.write("<!--[if IE 6]>");
document.write("...");
document.write("<![endif]-->");
document.write("");
document.write("<!--[if gt IE 6]>");
document.write("...");
document.write("<![endif]-->");
}
else {
document.write("...");
}
</script>
I problemi sono 2:
1) Il contenuto dentro else non risulta validato:
codice:
document.write("<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href...
You have used a character that is not considered a "name character" in an attribute value. Which characters are considered "name characters" varies between the different document types, but a good rule of thumb is that unless the value contains only lower or upper case letters in the range a-z you must put quotation marks around the value. In fact, unless you have extreme file size requirements it is a very very good idea to always put quote marks around your attribute values. It is never wrong to do so, and very often it is absolutely necessary.
2) Il css non viene caricato con firefox e netscape.
Ciao e grazie
P.S.: Precisazione: document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"fogli_di_stile/file.css\"/>");