if (window.document.images) {
var img = new Image();
img.src = "b.gif";
}
function changeImage( img, flag ) {
if ( flag ) {
window.document.images[ img ].src = "b.gif";
} else {
window.document.images[ img ].src = "a.gif";
}
}
<IMG src="a.gif" name="img1" width="22" height="22">
<A href="xxx.html"
onMouseOver="changeImage( 'img1', true );"
onMouseOut="changeImage( 'img1', false );">...</A>