Sunday, 12 September 2021

get src by id

for dyanmic images display image on popup 


 function showImage(i) {

  

   

        var img = document.getElementById('img_'+i);

        img.className = 'element';


        var modalImg = document.getElementById("img01");

        var captionText = document.getElementById("caption");


        modal.style.display = "block";

        modalImg.src = img.currentSrc;

        captionText.innerHTML = this.alt;

    }


read this link to know how to access the subnode of each element

for example get src.



No comments:

Post a Comment

remove duplicates in an sorted array

  using System; public class HelloWorld {          public static void Main(string[] args)     {         int[] ar={2,2,3,3,4,6,6};          C...