Jörg: Problem mit Schreibweise eines Links (Validierung bei W3C)

Beitrag lesen

Hallo Allerseits,

ich habe eine Frage an die Javascript-Experten hier. Ich habe in eine Website (XHTML 1.0 Transitional, utf-8) ein kleines JavaScript mit Funktionen zum gleichzeitigen Ein- bzw. Ausblenden mehrerer Ebenen (<div>-Container) eingebaut. Das Skript wird per onClick-Funktion bei Mausklick auf einen Link (bzw. mehrere Links) ausgelöst und funktioniert auch völlig problemfrei. Beim Validieren der Seite im W3C-Validator (http://validator.w3.org) bekam ich jedoch die folgende Meldung:

---Meldung---

<a href="#" onClick="ausblenden( 'sortiment');ausblenden( …

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

---Ende der Meldung---

Daraufhin habe ich die Schreibweise des Links geändert in:

<a href="javascript:ausblenden( 'sortiment');ausblenden( 'neuheiten');ausblenden( 'informatives');ausblenden( 'angebote');ausblenden( 'hinweise');ausblenden( 'anfahrt');ausblenden( 'impressum');einblenden( 'startseite'); return false;">Startseite</a>

... mit dem Ergebnis, das dann die Links bei Mausklick nicht reagieren. Anschliessend habe ich die Schreibweise dann nochmals geändert:

<a href="#" onClick="javascript:ausblenden( 'sortiment');ausblenden( 'neuheiten');ausblenden( 'informatives');ausblenden( 'angebote');ausblenden( 'hinweise');ausblenden( 'anfahrt');ausblenden( 'impressum');einblenden( 'startseite'); return false;">Startseite</a>

... nun funktionieren die Links zwar wieder, doch beim Validieren bekomme ich wieder die gleiche Meldung.

Ich bin leider in JavaScript nicht sonderlich bewandert, deshalb meine Bitte um Hilfe an die Experten hier, meine Bitte mir einen Rat zu geben, wie ich die Schreibweise ändern müsste.

Vielen Dank schon einmal im Voraus für Eure Bemühungen.