Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

folder array randomizer

    // Made By RashidYT
    
    // just like array randomizer but we will get the folder to get the images
    var selectedfolder = "/img/";

    // selects the <img> tag
    var image = document.getElementById("selected-image")

    // this is the array that will contain the images
    var images = [
        selectedfolder + "1.png",
        selectedfolder + "2.png",
        selectedfolder + "3.png",
    ]

    // finally. the image will be randomized when the page is loaded
    image.src = images[Math.floor(Math.random() * images.length)];
 
PREVIOUS NEXT
Tagged: #folder #array #randomizer
ADD COMMENT
Topic
Name
9+6 =