<img name=....> not XHTML?

I have rollover images on my site. It uses <img name="thename" ....> for the javascript to work. Now, when I tried to validate my site with XHTML strict, I get a warning that the "name" in invalid/deprecated. Now, what do I use do then?

using id is perfectly legitimate in XHTML. this is actually the easiest way to reference an img tag, however, like daniel0 shows in his example, you've got to make your images self-closing tags. the other problem that you might be facing (that daniel0 doesn't show) is that for valid XHTML, you also must have an alt attribute, even if it is empty.

You can't win, you can't lose, you can't break even... you can't even get out of the game.