W3C home > Mailing lists > Public > www-validator@w3.org > February 2013

Re: [VE][html5] name attribute in <a>

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Wed, 13 Feb 2013 20:52:01 +0200
Message-ID: <511BE0D1.6010506@cs.tut.fi>
To: www-validator@w3.org, hbcathey@gmail.com
2013-02-13 12:32, Hugh Cathey wrote:

> Lines of code:
> <a href="elinfo.html"
> onmouseover="document.elinfo.src='Images/elinfohover.png'"
> onmouseout="document.elinfo.src='Images/elinfo.png'">
>    <img src="Images/elinfo.png" alt="EL Info" name="elinfo" width="190"
> height="70" class="imgina"/>
> </a>
> The Validator told me that [name="elinfo"] was not necessary, when in
> fact it is for the lines of Java above it.
> Validating http://www.customelwire..com/ <http://www.customelwire.com/>

The validator is saying that that the name attribute is "obsolete" and reports it as an error. This is much stronger than saying that it is not needed.

In practice, browsers will keep supporting it in the foreseeable future, and the HTML5 CR even requires that.

But for modern authoring, the id attribute is recommended instead. In your JavaScript code (not Java - there is no Java on the page), you can replace document.elinfo.src by document.getElementById('elinfo'), if you replace the HTML attribute name="elinfo" by the attribute id="elinfo".

Yucca
Received on Wednesday, 13 February 2013 18:52:31 GMT

This archive was generated by hypermail 2.3.1 : Monday, 18 March 2013 18:07:59 GMT