xammm
Threadersteller
Dabei seit: 23.01.2006
Ort: Potsdam
Alter: 40
Geschlecht:
|
Verfasst Mo 13.03.2006 17:44
Titel JavaScript Problem mit Validator [erledigt] |
|
|
EDIT: Erledigt, hab den JavaKram in eine js-Datei ausgelagert
Hallo,
folgender Code:
Code: |
<script type="text/javascript">
var x = Zaehlerstand();
var y = "<table width='236' border='0' ........................ </tr></table>";
if (x == 1) y = "<img sr................................. alt=''>";
document.write(y);
</script>
|
Der Validator beschwert sich über den langen Inhalt der Variable y. Sie soll halt den Quelltext austauschen. Aber der Validator meckert dann an den ganzen kommenden Tags (auch außerhalb des JavaScript Berichs) rum. Er kommt also aus dem Tritt. Die Seite geht trotzdem. Ist es nicht erlaubt eine String-Variable in JavaScript beliebig zu füllen?
Gruß
Zuletzt bearbeitet von xammm am Mi 15.03.2006 01:18, insgesamt 1-mal bearbeitet
|
|
xammm
Threadersteller
Dabei seit: 23.01.2006
Ort: Potsdam
Alter: 40
Geschlecht:
|
Verfasst Di 14.03.2006 11:42
Titel
|
|
|
Code: | <script type="text/javascript">
var x = Zaehlerstand();
var y = "<table width='236' border='0' cellpadding='0' cellspacing='0' ><tr class='cellback_welcome2'><td valign='top'><table width='236' height='180' border='0' cellpadding='0' cellspacing='0'><td width='18' height='19'></td><td width='180' height='19'> </td><td height='19'> </td></tr><tr><td width='18' height='71'> </td><td width='180' height='71' valign='top'><div align='left'><a href='exit.php' class='xammm'>Notausgang</a> <br> <a href='arialu.php' class='xammm'>Arialu-Artikel</a><br><a href='projekte.php' class='xammm'>PC-Box Video</a></div></td><td height='71'><a href='changelog.php'><img src='1/trans000.gif' alt='' width='40' height='71' border='0'></a></td></tr><tr><td width='18' height='71'> </td><td width='180' height='71' valign='top'><div align='left' class='xammm'>Vernüftige Links<br>Changelog-Seite<br>Elektronik-Seite</div></td><td height='71'><a href='changelog.php'><img src='1/trans000.gif' alt='' width='40' height='71' border='0'></a></td></tr><tr><td width='18' height='53'> </td><td width='180' height='53' valign='top'><div align='left'><a href='http://www.ratemypoo.com/ratemy/poo' target='_blank' class='xammm'>Achtung, ekelhaft!</a><br><span class='Besucheranzahl'>Du bist zum " + x + ". mal auf xammm.com! :)</span> </div></td><td height='53'><a href='changelog.php'><img src='1/trans000.gif' alt='' width='40' height='53' border='0'></a></td></tr></table></td></tr></table>";
if (x == 1) y="<img src='1/willkommen.gif' width='236' height='214' alt=''>";
document.write(y);
</script> |
1.) Error Line 305, column 226: end tag for "SCRIPT" omitted, but its declaration does not permit this .
...g='0'><td width='18' height='19'></td><td width='180' height='19'> </td>
You forgot to close a tag, or
you used something inside this tag that was not allowed, and the validator is complaining that the tag should be closed before such content can be allowed.
The next message, "start tag was here" points to the particular instance of the tag in question); the positional indicator points to where the validator expected you to close the tag.
✉
2.) Info Line 303, column 0: start tag was here .
<script type="text/javascript">
3.) Error Line 308, column 8: end tag for element "SCRIPT" which is not open .
</script>
The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.
If this error occured in a script section of your document, you should probably read this FAQ entry.
✉
4.) Error Line 309, column 3: end tag for element "P" which is not open .
</p>
✉
5.) Error Line 310, column 4: end tag for element "TD" which is not open .
</td>
----------------------------------------------------------------------------
ab 4.) fangen halt Fehler an, die sich auf den Quelltext nach dem Script beziehen. Da sind noch mehr. Wenn ich das Script entferne (bzw. die beiden Quelltext-Zuweisungen für y), dann gibt es keine Fehler im Dokument. Auch nicht in dem Bereich nach dem Skript. Der Quelltext, der y zugewiesen wird, ist eigentlich an sich in Ordnung.
Gruß
|
|