WCM - Das österreichische Computer Magazin Forenübersicht
 

Zurück   WCM Forum > Rat & Tat > Programmierung

Programmierung Rat & Tat für Programmierer

Microsoft KARRIERECAMPUS

Antwort
 
Themen-Optionen Ansicht
Alt 07.10.2002, 00:09   #1
kingchaos01
Veteran
 
Registriert seit: 30.09.2000
Beiträge: 267


Frage [HTML] Anchor-Prob

Hallo!

Was ist falsch an dieser Konstruktion:

<a name="comp_start"></a>

Der HMTL-Validator vom W3c moniert:

Error: element "A" not allowed here; possible cause is an inline element containing a block-level element

SelfHTML meint:
Es ist durchaus erlaubt, einen leeren Anker zu notieren, also <a name="Ankername"></a>...

Ich versteh's nicht ganz!
Roland
kingchaos01 ist offline   Mit Zitat antworten
Alt 07.10.2002, 05:42   #2
_m3
Inventar
 
Registriert seit: 24.09.2001
Beiträge: 7.335


Standard

SelfHTML ist NICHT die HTML-Spezifikation!

http://www.w3.org/TR/html401/struct/links.html#h-12.2
Zitat:
Since the A element has content (text, images, etc.), user agents may render this content in such a way as to indicate the presence of a link (e.g., by underlining the content).
...
Each A element defines an anchor
1. The A element's content defines the position of the anchor.
http://www.w3.org/TR/html401/intro/sgmltut.html
Zitat:
Some HTML element types have no content. For example, the line break element BR has no content; its only role is to terminate a line of text. Such empty elements never have end tags. The document type definition and the text of the specification indicate whether an element type is empty (has no content) or, if it can have content, what is considered legal content.
Nachdem die Spezifikation des A-Tags sowohl einen Content, als auch einen End-Tag vorgibt, darf der Content nicht leer sein.
____________________________________
Weiterhin zu finden auf http://martin.leyrer.priv.at , http://twitter.com/leyrer , http://www.debattierclub.net/ , http://www.tratschen.at/ und via Instant Messaging auf Jabber: m3 <ät> cargal.org .
_m3 ist offline   Mit Zitat antworten
Alt 07.10.2002, 12:20   #3
kingchaos01
Veteran
 
Registriert seit: 30.09.2000
Beiträge: 267


Standard

Einspruch, euer Ehren!

weiter unten in Text:

Note. User agents should be able to find anchors created by empty A elements, but some fail to do so. For example, some user agents may not find the "empty-anchor" in the following HTML fragment:

<A name="empty-anchor"></A>
...some HTML...
Link to empty anchor


Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8859-1">
<title>Test</title>
</head>
<body>
<A name="empty-anchor"></A>

Link to empty anchor

</body>
</html>
^^^^ Das geht nicht!


Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"          "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8859-1">
<title>Test</title>
</head>
<body>
<A name="empty-anchor"></A>

Link to empty anchor

</body>
</html>
^^^ Das geht!

Es liegt offensichtlich am verwendeten Doctype.
Des Rätsels Lösung steht auch in SelfHTML (für "Strict"):
"So ist es in dieser Variante beispielsweise nicht erlaubt, zwischen <body> und </body> einfach nur Text zu notieren. Alle Inhalte müssen in so genannten Block-Elementen stehen, z.B. in Überschriften, Textabsätzen, Tabellen usw."
Es liegt also gar nicht am fehlenden A-Inhalt, sondern am fehlenden Block-Element.

Wieder was gelernt!
Grüße
Roland
kingchaos01 ist offline   Mit Zitat antworten
Alt 07.10.2002, 13:49   #4
_m3
Inventar
 
Registriert seit: 24.09.2001
Beiträge: 7.335


Standard

Zitat:
Original geschrieben von kingchaos01
Wieder was gelernt!
____________________________________
Weiterhin zu finden auf http://martin.leyrer.priv.at , http://twitter.com/leyrer , http://www.debattierclub.net/ , http://www.tratschen.at/ und via Instant Messaging auf Jabber: m3 <ät> cargal.org .
_m3 ist offline   Mit Zitat antworten
Alt 07.10.2002, 19:43   #5
Seidl
Veteran
 
Registriert seit: 10.01.2001
Beiträge: 478


Standard

Bin nur neugierig. Wozu braucht man einen leeren Link?
Seidl ist offline   Mit Zitat antworten
Alt 07.10.2002, 19:47   #6
kingchaos01
Veteran
 
Registriert seit: 30.09.2000
Beiträge: 267


Standard

Zitat:
Original geschrieben von Seidl
Bin nur neugierig. Wozu braucht man einen leeren Link?
Is ja kein Link, sonder ein Anchor.
Wenn man mehrere davon hat, is der Text dazwischen unpraktisch.
kingchaos01 ist offline   Mit Zitat antworten
Alt 08.10.2002, 07:48   #7
Seidl
Veteran
 
Registriert seit: 10.01.2001
Beiträge: 478


Standard

Ich fürchte ich verlerne langsam das lesen. Dabei wäre der Unterschied zwischen name und href eigentlich recht gut zu erkennen. Werde mich in Zukunft anstrengen besser zu lesen bevor ich planlose Fragen stelle.

so long
Seidl
Seidl ist offline   Mit Zitat antworten
Antwort


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.

Gehe zu


Alle Zeitangaben in WEZ +2. Es ist jetzt 03:43 Uhr.


Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Forum SEO by Zoints
© 2009 FSL Verlag