image.src
returns the physical path of image. So you can use indexOf
to match image name. Following code snippet may help you.
function changeColor(image) {
if (image.src.indexOf("circleRed.png")>-1) {
image.src = "circleBlue.png";
} else {
image.src = "circleRed.png";
}
}