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

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 UTC