I tried to create a function where when the button is clicked the source of the image changed, but it didn’t work.
<img
class="bowgart"
id="bowgart"
src="C:\Users\jbrir\Documents\BowgartWebsite2\images\bowgart.png"
alt="Bowgart"
/>
<script>
function imgOpen() {
document.getElementById("bowgart").src =
"C:UsersjbrirDocumentsBowgartWebsite2imagesBowgart_open.jpeg";
}
</script>
>Solution :
The src needs to be a valid URL. You’re missing the file: URL scheme and all the / delimiters in the pathname.
function imgOpen() {
document.getElementById("bowgart").src =
"file:///C:/Users/jbrir/Documents/Bowgart/Website2/images/Bowgart_open.jpeg";
}