Name attribute not XHTML valid

Giganews Newsgroups
Subject: Name attribute not XHTML valid
Posted by:  piraticm…@gmail.com
Date: 7 Apr 2005

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

Replies