Name attribute not XHTML valid

Discussion in 'XML' started by piraticman@gmail.com, Apr 7, 2005.

  1. Guest

    Hi. I have some code for a javascript jump menu... It validated with
    HTML 4.0 but now does not validate with XHTML strict 1.0.

    I have used name atributes in my code which aparantly are not allowed
    now. I have spent all day trying to figure out a solution with no
    luck. I have tried document.forms[0] and various other things but
    havent known exactly what to do with them and couldn't get them to
    work. Below I will show you my current code and what the w3c.org
    validator comes up with. If someone could change this code for me to
    be XHTML valid I would be very grateful.

    -------------------------
    My HTML

    <form name="jump" action ="">
    <script type="text/javascript">
    function jumpMenu(){
    location=document.jump.menu.options[document.jump.menu.selectedIndex].value;
    }
    </script>
    <select name="menu"
    style="font-family:'Verdana';color:#000000;background-color:#99CCFF;font-size:10pt;">
    <option value="index.html">HOME</option>
    <option value="about.html">About Us</option>
    <option value="#">-----------------</option>
    <option value="showroom.html">Show Room</option>
    <option value="dining.html">-Dining</option>
    <option value="prints.html">-Prints</option>
    <option value="mirrors.html">-Mirrors</option>
    <option value="accessories.html">-Accessories</option>
    <option value="lighting.html">-Lighting</option>
    <option value="#">-----------------</option>
    <option value="glazing.html">Glazing &amp; Boarding</option>
    <option value="laminated.html">Laminated Glass</option>
    <option value="processing.html">Processing</option>
    <option value="design.html">Design</option>
    <option value="stained.html">Stained &amp; Leaded</option>
    <option value="#">-----------------</option>
    <option value="contact.html">Contact Us</option>
    </select>
    <a href="javascript:jumpMenu();"><img src="go.jpg" alt="Go!"
    /></a>
    </form>

    ------------------

    w3c validator results


    Line 51, column 13: there is no attribute "name"

    <form name="jump" action ="">

    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.



    Line 57, column 108: document type does not allow element "select"
    here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div",
    "pre", "address", "fieldset", "ins", "del" start-tag

    ....ground-color:#99CCFF;font-size:10pt;">

    The mentioned element is not allowed to appear in the context in which
    you've placed it; the other mentioned elements are the only ones that
    are both allowed there and can contain the element mentioned. This
    might mean that you need a containing element, or possibly that you've
    forgotten to close a previous element.

    One possible cause for this message is that you have attempted to put
    a block-level element (such as "<p>" or "<table>") inside an inline
    element (such as "<a>", "<span>", or "<font>").


    Line 76, column 36: document type does not allow element "a" here;
    missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre",
    "address", "fieldset", "ins", "del" start-tag

    <a href="javascript:jumpMenu();"><img src="go.jpg" alt="Go!" /></a>

    ---------------------------------------------

    Thanks in advance

    Daniel Callus
     
    , Apr 7, 2005
    #1
    1. Advertising

  2. Dean Tiegs Guest

    On Thu, 07 Apr 2005 13:50:40 -0700, piraticman wrote:

    > Hi. I have some code for a javascript jump menu... It validated with
    > HTML 4.0 but now does not validate with XHTML strict 1.0.
    >
    > I have used name atributes in my code which aparantly are not allowed
    > now.


    You have two small problems, but they should be easy to fix.

    > Line 51, column 13: there is no attribute "name"
    >
    > <form name="jump" action ="">


    From the HTML 4.01 spec
    <http://www.w3.org/TR/html401/interact/forms.html#adef-name-FORM>:

    name = cdata
    [CI]
    This attribute names the element so that it may be referred to from
    style sheets or scripts. Note. This attribute has been included for
    backwards compatibility. Applications should use the id attribute to
    identify elements.

    So, change "name" to "id".

    > Line 57, column 108: document type does not allow element "select" here;
    > missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre",
    > "address", "fieldset", "ins", "del" start-tag
    >
    > ...ground-color:#99CCFF;font-size:10pt;">
    >
    > The mentioned element is not allowed to appear in the context in which
    > you've placed it; the other mentioned elements are the only ones that
    > are both allowed there and can contain the element mentioned. This might
    > mean that you need a containing element, or possibly that you've
    > forgotten to close a previous element.


    In HTML strict and XHTML strict, the "form" element cannot directly
    contain "input", "select", etc. The "form" element has to
    contain a block container element, like "p" or "div", which in turn
    contains the "select".

    See the examples from the HTML spec linked above for how to do it right.
     
    Dean Tiegs, Apr 7, 2005
    #2
    1. Advertising

  3. wrote:

    > Hi. I have some code for a javascript jump menu... It validated with
    > HTML 4.0 but now does not validate with XHTML strict 1.0.


    You multiposted this and got answers elsewhere. Please post to one
    group only in future, and select the right group. Multiposting is bad.
    Don't do multipost, mm'kay?

    Questions that are specifically about HTML, including XHTML, should
    normally be posted to comp.infosystems.www.authoring.html.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Apr 8, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. anonymous
    Replies:
    1
    Views:
    5,964
  2. =?Utf-8?B?TWFyaw==?=
    Replies:
    4
    Views:
    634
    =?Utf-8?B?TWFyaw==?=
    Dec 14, 2006
  3. Radu
    Replies:
    2
    Views:
    1,347
  4. perspolis
    Replies:
    1
    Views:
    2,575
    Mark Rae
    Jan 23, 2007
  5. SMH
    Replies:
    3
    Views:
    1,058
    Beauregard T. Shagnasty
    Jun 14, 2008
Loading...

Share This Page