0

I'm currently working on a web page. Everything is working but when I went to validate, I ran into an error. The W3C validator says the name attribute is obsolete. Everything works, but no errors would be nice.

line from About_me.html

<img name="slide" alt="images about me" width="600" height="400">

line from slideshow.JS

function changeImg(){
    document.slide.src = images[i];

When I go to validate I get the following error "The name attribute on the img element is obsolete. Use the id attribute instead." When I change name to id the slide show no longer works. What to do?

Salomon Zhang
  • 1,553
  • 3
  • 23
  • 41
wfarrar
  • 3
  • 2

1 Answers1

0

If you change the field of the img element from name to id, then you will have to use

document.getElementById("slide").src = images[i];

instead of just

document.slide.src = images[i];

Hope this helps! :D

kylew
  • 150
  • 1
  • 11