as soon as you click on the picture, the picture will be swapped and a new window will open automatically on https://stackoverflow.com/. Any ideas/support what i have missed that this combination would work? Currently the picture is swapping, unfortunately the new window doesn't open.
document.getElementById("img").onclick = function() {
if(this.src == "https://www.w3schools.com/html/img_girl.jpg"){
this.src = "https://www.w3schools.com/html/pic_trulli.jpg";
} else {
this.src = "https://www.w3schools.com/html/img_girl.jpg";
}
};
<a href="##"onClick="window.open('https://stackoverflow.com/', '_blank','width=900,height=880, toolbar=no,location=no,directories=no,statu s=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=no'), BoldText(this);"><img id="img" src="https://www.w3schools.com/html/img_girl.jpg" height="22" width="22" alt="Twitter"></a>