Seite 2 von 3

Re: [Snippet] Schneefall - Snow

Verfasst: 08.12.2010 14:39
von o0Pascal0o
http://validator.w3.org meldet mir, dass das Snippet nicht XHTML-valide ist:

Code: Alles auswählen

Line 164, Column 56: document type does not allow element "img" here

        Falling(20,"<img src='images/snow.gif' alt='' />");

✉

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

Re: [Snippet] Schneefall - Snow

Verfasst: 08.12.2010 20:16
von John Doe
Schockschwerenot, der meldet viel, wenn der Tag lang ist.
Was bedeutet das jetzt für dich?

Re: [Snippet] Schneefall - Snow

Verfasst: 08.12.2010 20:22
von o0Pascal0o
Hmm.. ist hatl nicht XHTML-valide. Kann man das nicht verändern, so dass es valida ist? Damit alle Browser es vernünftig darstellen können, etc.

Re: [Snippet] Schneefall - Snow

Verfasst: 08.12.2010 20:46
von BNa
o0Pascal0o hat geschrieben:Kann man das nicht verändern, so dass es valida ist?
Das ist ganz einfach :geek:

finde

Code: Alles auswählen

    <script type="text/javascript" >
    function snow()
    {
        Falling(20,"<img src='images/snow.gif' alt='' />");
    }
    </script>
ersetze mit

Code: Alles auswählen

    <script type="text/javascript" >
    <![CDATA[
    function snow()
    {
        Falling(20,"<img src='images/snow.gif' alt='' />");
    }
    ]]>
    </script>

Re: [Snippet] Schneefall - Snow

Verfasst: 08.12.2010 22:07
von o0Pascal0o
nur danach fällt ken Schnee mehr!

Re: [Snippet] Schneefall - Snow

Verfasst: 08.12.2010 22:15
von BNa
So sollte es funktionieren.

Code: Alles auswählen

<script type="text/javascript" >
// <![CDATA[
function snow()
{
Falling(20,"<img src='images/snow.gif' alt='' />");
}
// ]]>
</script>

Re: [Snippet] Schneefall - Snow

Verfasst: 08.12.2010 22:36
von o0Pascal0o
Das tut es auch, danke Dir BNa!

Re: [Snippet] Schneefall - Snow

Verfasst: 08.12.2010 22:39
von BaerchenHH
OMG...
Wollt ihr ihn ganz aus der Fassung bringen???

Re: [Snippet] Schneefall - Snow

Verfasst: 08.12.2010 22:42
von o0Pascal0o
Wieso, das funktioniert doch jetzt. Alles Bestens! :)

Re: [Snippet] Schneefall - Snow

Verfasst: 08.12.2010 22:45
von BaerchenHH
Dann spar dir 2 Zeilen und entferne das oragefarbene:

Code: Alles auswählen

// <![CDATA[
...
// ]]>    
oder besser... baue es gar nicht erst ein!