I want to use checkbox to display image base on the type of image that has been checked. i try to do that but the image is not displaying. i don’t know what i am doing wrong.
function displaybgimage() {
var img1=document.getElementById("check-option8");
var bg = document.getElementById("container");
var dolphin1=document.getElementById("dolphin2");
if(img1.checked){
bg.innerHTML=dolphin1;
}
}
I have updated my function but the image is still not displayed i want to display the image in “bg” container. I a not sure what I am doing wrong.
function displaybgimage() {
var image=document.getElementsByTagName("img");
var src0=image[2].getAttribute("src");
var img1=document.getElementById("check-option8");
var bg = document.getElementById("container");
var dolphin1=document.getElementById("dolphin2");
if(img1.checked){
bg.src=src0;
}
}