I am trying to compare an image in javascript. If the image is true it will change to a different image. I wrote an if statement but it doesn't seem to work. Does anyone know how I can achieve this?
function test()
{
imageElement = document.getElementById('pic');
if(imageElement.src == "images/cat_12.gif"){
imageElement.src = "images/press2_12.gif";
}else{
}
}
imageElement.srccontain?.getAttribute('src')would make it work I think.