In this lesson we use an image tag,...

where hovering over it...

has it changed in this function.

elm.src = 'imgh.png' .

Taking the mouse of the image,...

lets the previous image be shown.

To that end we save the current image's name, if it's not equal to 'imgh'.

Choosing another line in the 'select'...

changes the picture immediately.

Choosing another radio button doesn't effect change immediately,...

but clicking the button next to them,...

does.

Another DOM method is used, 'getElementsByName',...

that's why they all bear the same name, 'group1'. This is also important for these radio buttons to function as a group, where only one can be chosen at a time.

'getElementsByName' returns an array,...

that is processed in a 'for' loop.

The 'checked' property can be 'true' for only one of them,...

so after calling 'doit', the function is left immediately with 'return'.

Notice the curly brackets, since there are more than one statement in the 'if' 's branch.