How to use id instead of name to change image src

Stupid question – but those are the easiest to answer, I guess.
All answers I’ve found are all too sophisticated.

This excerpt works but is not XHTML strict compliant because of illegal use of “name”


function animator() {
  [B]document.animimage.src = anims[frame].src;[/B]    <-- this is the offending javascript but it works
  frame = (frame + 1);
  if(frame >= 7) {
	frame = 0;
  }
  timeout_state = setTimeout("animator()", 2200);
}
...
</head>
<body>
...
<div id="rotator">
  <img src="images/stress0.jpg" [B]name[/B]="animimage" alt="stressed lady" height="168" width="125" /> <-- name is illegal
</div>


This doesn’t work using what examples I can find.


function animator() {
  document.[B]getElementById[/B]("animimage").innerHTML = anims[frame].src; <-- what do I use instead
  frame = (frame + 1);
  if(frame >= 7) {
    frame = 0;
  }
  timeout_state = setTimeout("animator()", 2200);
}
...
</head>
<body>
...
<div id="rotator">
  <img src="images/stress0.jpg" [B]id=[/B]"animimage" alt="stressed lady" height="168" width="125" /> <-- id is legal
</div>

I also tried

document.[B]getElementById[/B]("animimage").[B]value[/B] = anims[frame].src;

to no avail

document.getElementById(‘animimage’).src = anims[frame].src;