Name attribute question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Neville310

    Name attribute question

    I have a few questions about the name attributes and href referencing
    to. Can you declare name attributes for tags other than anchor
    elements (like div or h2)? The validator keeps returning the following
    error for HTML 4.0 strict .

    Line 139, column 12: there is no attribute "NAME"

    <h2 name="heading"> H2 Headline </h2>

    | 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 "Transition al" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheig ht" (this is usually fixed by using CSS to achieve the desired effect instead).

    My goal is to create hot links to specific sections of the document.
    This objective does not refer to documents outside the current
    document covered by traditional anchor elements (href). One developer
    suggested that you could replace the following.

    <a name="heading"> </a>

    <h2 name="heading"> H2 Headline </h2>

    So I made the changes and discovered that these changes did not
    validate. This discovery happens after sometime away from the document
    in question. Upon revisiting the document, the errors left me
    perplexed and at odds. A quick Google search only led me to
    descriptions about traditional anchors and the name attributes. These
    results did not mention name attributes in other elements. Maybe, I
    did not remember the correct term for hot links within a document.
    Does anybody have any links that explain what I call hot links? Does
    this scenario only occur in HTML 4.0 (and not xHTML)? Please give a
    brief description of this topic if appropriate.

  • Jim Moe

    #2
    Re: Name attribute question

    Neville310 wrote:[color=blue]
    >
    > My goal is to create hot links to specific sections of the document.
    > This objective does not refer to documents outside the current
    > document covered by traditional anchor elements (href). One developer
    > suggested that you could replace the following.
    >
    > <a name="heading"> </a>
    > <h2 name="heading"> H2 Headline </h2>
    >[/color]
    Use the "id" tag. The id value must be unique to validate.

    --
    jmm dash list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)

    Comment

    • Spartanicus

      #3
      Re: Name attribute question

      Inappropriate crosspost to c.iw.a.styleshe ets removed

      Neville310 <r0bert_neville @y@h00.com> wrote:
      [color=blue]
      ><h2 name="heading"> H2 Headline </h2>
      >
      >My goal is to create hot links to specific sections of the document.[/color]

      <h2 id="heading">H 2 Headline </h2>

      --
      Spartanicus

      Comment

      • jake

        #4
        Re: Name attribute question

        In message <ftnmc1d2mtkus2 cma9vatdiium7ae s5vop@4ax.com>, Neville310
        <r0bert_neville @y.?.com.invali d> writes[color=blue]
        >I have a few questions about the name attributes and href referencing
        >to. Can you declare name attributes for tags other than anchor
        >elements (like div or h2)? The validator keeps returning the following
        >error for HTML 4.0 strict .
        >
        > Line 139, column 12: there is no attribute "NAME"
        >
        ><h2 name="heading"> H2 Headline </h2>
        >
        >| 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 "Transition al" document type to
        >get the "target" attribute), or by using vendor proprietary extensions
        >such as "marginheig ht" (this is usually fixed by using CSS to achieve
        >the desired effect instead).
        >
        >My goal is to create hot links to specific sections of the document.
        >This objective does not refer to documents outside the current
        >document covered by traditional anchor elements (href). One developer
        >suggested that you could replace the following.
        >
        ><a name="heading"> </a>
        >
        ><h2 name="heading"> H2 Headline </h2>
        >
        >So I made the changes and discovered that these changes did not
        >validate. This discovery happens after sometime away from the document
        >in question. Upon revisiting the document, the errors left me
        >perplexed and at odds. A quick Google search only led me to
        >descriptions about traditional anchors and the name attributes. These
        >results did not mention name attributes in other elements. Maybe, I
        >did not remember the correct term for hot links within a document.
        >Does anybody have any links that explain what I call hot links? Does
        >this scenario only occur in HTML 4.0 (and not xHTML)? Please give a
        >brief description of this topic if appropriate.
        >[/color]

        <div style="width:10 0%;">
        <h2 id="lab0"><a name="lab0">INT RODUCTION.</a></h2>
        </div>


        --
        Jake
        (jake@gododdin. demon.co.uk .... just a spam trap.)

        Comment

        • Johannes Koch

          #5
          Re: Name attribute question

          jake wrote:
          [color=blue]
          > <h2 id="lab0"><a name="lab0">INT RODUCTION.</a></h2>[/color]

          Have a look at the illegal example in
          <http://www.w3.org/TR/html4/struct/links.html#h-12.2.3>

          xpost and f'up2 ciwah
          --
          Johannes Koch
          In te domine speravi; non confundar in aeternum.
          (Te Deum, 4th cent.)

          Comment

          • jake

            #6
            Re: Name attribute question

            In message <42cbb01c$0$238 $892e7fe2@authe n.white.readfre enews.net>,
            Johannes Koch <koch@w3develop ment.de> writes[color=blue]
            >jake wrote:
            >[color=green]
            >> <h2 id="lab0"><a name="lab0">INT RODUCTION.</a></h2>[/color]
            >
            >Have a look at the illegal example in
            ><http://www.w3.org/TR/html4/struct/links.html#h-12.2.3>
            >
            >xpost and f'up2 ciwah[/color]

            That's interesting.

            I guess I've never come across that before because the format that I've
            been using for years has always validated (HTML 4 Strict) according to
            the w3c validator and always worked.

            So, presumably you should be able to use:
            <a id="lab1" name="lab1"></a>

            This also validates.

            But although it works in Opera and Firefox, it doesn't do so in IE6.

            So, I guess <a id="lab1" name="lab1">&nb sp;</a> is the format of
            choice.... which does validate and work in IE/Opera/Firefox.


            So:

            <div style="width:10 0%;">
            <a id="lab1" name="lab1">&nb sp;</a>
            </div>
            <h2>INTRODUCTIO N.</h2>

            What do you think?

            regards.


            --
            Jake
            (jake@gododdin. demon.co.uk .... just a spam trap.)

            Comment

            • SeaPlusPlus

              #7
              Re: Name attribute question

              jake wrote:
              [color=blue]
              > So, presumably you should be able to use:
              > <a id="lab1" name="lab1"></a>[/color]
              [color=blue]
              > This also validates.[/color]
              [color=blue]
              > But although it works in Opera and Firefox, it doesn't do so in IE6.[/color]
              [color=blue]
              > So, I guess <a id="lab1" name="lab1">&nb sp;</a> is the format of
              > choice.... which does validate and work in IE/Opera/Firefox.[/color]
              [color=blue]
              > So:[/color]
              [color=blue]
              > <div style="width:10 0%;">
              > <a id="lab1" name="lab1">&nb sp;</a>
              > </div>
              > <h2>INTRODUCTIO N.</h2>[/color]
              [color=blue]
              > What do you think?[/color]

              When I encode footnote references I have the refence link to the
              footnote and the footnote links back to the reference in the body so
              people can return after reading the footnote.

              This is XHTML 1.0 valid I believe it works and validates in HTML 4.01 also.

              <p>
              This is footnoted.<a href="#011" name="011b"><su p>1</sup></a>
              </p>

              <h5>
              Footnotes
              </h5>

              <div class="XFootnot e">
              <a href="#011b" name="011"><cod e>1</code></a>. This is the footnote.
              </div>

              Thank you...

              Rich

              Comment

              • Harlan Messinger

                #8
                Re: Name attribute question

                Jim Moe wrote:[color=blue]
                > Neville310 wrote:
                >[color=green]
                >>
                >> My goal is to create hot links to specific sections of the document.
                >> This objective does not refer to documents outside the current
                >> document covered by traditional anchor elements (href). One developer
                >> suggested that you could replace the following.
                >>
                >> <a name="heading"> </a>
                >> <h2 name="heading"> H2 Headline </h2>
                >>[/color]
                > Use the "id" tag. The id value must be unique to validate.
                >[/color]
                There's no such thing as an "id" tag. Have you ever seen <id> in an HTML
                file?

                Comment

                • Neville310

                  #9
                  Re: Name attribute question

                  On Wed, 06 Jul 2005 12:14:29 +0200, Johannes Koch
                  <koch@w3develop ment.de> wrote:
                  [color=blue]
                  >jake wrote:
                  >[color=green]
                  >> <h2 id="lab0"><a name="lab0">INT RODUCTION.</a></h2>[/color]
                  >
                  >Have a look at the illegal example in
                  ><http://www.w3.org/TR/html4/struct/links.html#h-12.2.3>
                  >
                  >xpost and f'up2 ciwah[/color]

                  I am totally confused with these conflicting points. I found the above
                  link before posting and it did enlighten me on the topic. But it made
                  no mention of the name attributes outside the anchor element.

                  The solution is not the challenge here. The ideal insight would
                  include a primer for reference. I am not a full time HTML coder; so
                  sometimes I need to revisit more discrete concepts about HTML.

                  Finally, this scenario came about in a thread similar to this one.
                  Folks, as your teacher once said include your references (like the
                  link above). =P

                  Comment

                  • Alan J. Flavell

                    #10
                    Re: Name attribute question

                    On Wed, 6 Jul 2005, Neville310 and MISSINGr0bert_n evilleTERMINATO R wrote:
                    [color=blue]
                    > Finally, this scenario came about in a thread similar to this one.
                    > Folks, as your teacher once said include your references (like the
                    > link above). =P[/color]

                    The only authoritative reference for this kind of question (i.e
                    validity as determined by a formal validator) is the relevant W3C DTD,
                    as cited by your chosen DOCTYPE.

                    However, I've always found the WDG HTML reference, for HTML4 at
                    http://www.htmlhelp.com/reference/html40/ ,
                    to be a reliable, commented and organised list of elements.

                    As they say about "common attributes":
                    A description of the HTML 4 attributes that are common to most elements, including core attributes, internationalization attributes, and scripting events.


                    Note that most browsers do not support the ID attribute for link
                    anchors. For current browsers, authors should use <A
                    NAME="...">...</A> within the element instead of ID.

                    (that statement about "most browsers" is obsolescent now, it should
                    better say "some browsers" or "mostly older browsers")

                    If you put the id= attribute on the same <a name="..."> element, then
                    you can use the same name for both, which is probably what you'd want.
                    If you put the id= attribute on an enclosing element, then you'd have
                    to use different names, as they remark.

                    In the final analysis, however, one has to verify whatever one thinks
                    one has learned there by reference to the DTD and to the results from
                    a formal validator.

                    hope this helps

                    Comment

                    • Jim Moe

                      #11
                      Re: Name attribute question

                      Harlan Messinger wrote:[color=blue][color=green][color=darkred]
                      >>>
                      >>> <a name="heading"> </a>
                      >>> <h2 name="heading"> H2 Headline </h2>
                      >>>[/color]
                      >> Use the "id" tag. The id value must be unique to validate.
                      >>[/color]
                      > There's no such thing as an "id" tag. Have you ever seen <id> in an HTML
                      > file?[/color]

                      <sigh>. Ya know, I had originally said "attribute" but then second
                      guessed myself by thinking about "tag soup" styling.
                      And mentioning that it is a attribute rather than a tag is more
                      informative than "Bzzt! Wrong!"

                      --
                      jmm dash list (at) sohnen-moe (dot) com
                      (Remove .AXSPAMGN for email)

                      Comment

                      Working...