Ich verwende auf meiner Seite zur Korrektur von Anzeigeproblemen in Netscape 4.x ein kleines Script, das mir einige CSS-Definitionen, die ich in der zentralen .CSS Datei festgelegt habe zurechtbiegt.
Der Code dazu sieht so aus:
<script language="JavaScript" type="text/javascript">
19: <!--
20: if((navigator.appName == "Netscape") && (navigator.appVersion.charAt(0) < "5"))
21: {
22: document.writeln('<style type="text/css"> td.header {background-color : white; border : none; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 12pt; font-style : normal; font-weight : normal; text-align : center; vertical-align : middle; width: auto;height: 40px; padding : 2px 10px 2px 10px;} td.plain {background-color : white; border : none; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-style : normal; font-weight : normal; padding : 0px 0px 0px 0px; width: auto; height: auto;} .button {width:auto; border:none;} td {background : White; border : 1px solid Black; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 11pt; font-style : normal; font-weight : normal; text-align : center; vertical-align : middle; width: 200px; height: 40px; padding : 2px 10px 2px 10px;} </style>');
23: }
24: else
25: {
26:
27: }
28: -->
29: </script>
wäre nach meiner Ansicht eigentlich korrekt und funktioniert auch wunderprächtig.
Der W3 Validator meint dazu jedoch:
This page is not Valid HTML 4.01 Transitional!
Line 22, column 850: end tag for element "STYLE" which is not open (explain...).
...padding : 2px 10px 2px 10px;} </style>');
^
weiters wird bei Netscape 4.x ein Hinweis eingeblendet, dass es einige Darstellungsfehler gibt, welcher auch mittels Browserversionsabfrage und document.writeln() realisiert, welche den Validator ebenfalls stört:
Line 79, column 381: end tag for element "P" which is not open (explain...).
...unter. Bitte dies zu entschuldigen</p><p class="klein"> </p>');
^
Line 79, column 408: end tag for element "P" which is not open (explain...).
...uldigen</p><p class="klein"> </p>');
^
Angefangen natürlich mit document.writeln('<p class="..."> ......
Jemand eine Idee, was da faul ist und wie man den Validator dazu überredet, das Ganze zu akzeptieren oder was ich ändern muss?