Hallo zusammen.
Ich bin seit heute Abend damit beschäftigt meine Website so zu optimieren dass sie komplett W3-Valide ist.
Nur bin ich momentan auf folgendes Problem gestoßen:
Ich führe einen Browerstest durch und möchte u.a. prüfen ob der Benutzter Javascript aktiviert hat. Dafür verwende ich folgenden Code:
<noscript><td bgcolor="#FF0000">Nicht Erlaubt.</td></noscript>
<script type="text/javascript">
document.write("<td bgcolor=\"#00CC00\">Erlaubt.</td>");
</script>
Dies funktioniert so auch einwandfrei, leider bekomme ich beim W3 diese Fehlermeldung:
-->
document type does not allow element "NOSCRIPT" here; missing one of "TH", "TD" start-tag
<noscript><td bgcolor="#FF0000">Nicht Erlaubt.</td></noscript>
The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.
One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").
<--
Es ist jetzt das erste mal, dass ich aktiv mit dem Valdidator arbeite, aber so wie ich das erkenne möchte er einfach, dass der <td> Tag den <noscript> Tag einklammert und nicht andersrum:
<td bgcolor="#FF0000"><noscript>Nicht Erlaubt.</noscript></td>
<script type="text/javascript">
document.write("<td bgcolor=\"#00CC00\">Erlaubt.</td>");
</script>
Dies ist zwar dann valide, aber erzeugt leider eine rote (leere) Spalte bei Usern die Javascript aktiviert haben. Das soll natürlich nicht so sein.
Ich hoffe ich habe mein Problem verständlich geschildert und jemand von euch kennt eine Möglichkeit es zu lösen.