previousElementSibling

HTML
<p><img src="../img/but1.jpg" ><input type="checkbox" id="c4"><label for="c4">Test 4</label></p>

Script

  const check = document.querySelectorAll( "input" );
  check.forEach( el => el.addEventListener( "click", setImg ) );
  function setImg ( evt )
  {
    const ck = evt.currentTarget;
    if ( ck.checked )
    {
      ck.previousElementSibling.src = "../img/but3.jpg";
    } else
    {
      ck.previousElementSibling.src = "../img/but1.jpg";
    }
  }