Hello Reader's If you want to show image on a click event. Then using javascript you can use this in real time.
Let's see the example below:-
<button onclick="add_google_logo();">Add Google Logo</button>
Now the JS will go like this:-
function add_google_logo() {
var src = "http://google.com/images/logo.gif"; //here you have to set the link of image
show_image("http://google.com/images/logo.gif", 276,110, "Google Logo"); // give the details of image
}
function show_image(src, width, height, alt) {
var img = document.createElement("img");
img.src = src;
img.width = width;
img.height = height;
img.alt = alt;
document.body.appendChild(img);
}
Now when user click the button a div will open and show the image.
0 Comment(s)