[Solved] switching between pictures randomally [closed]


I made you a page that switches between two images in a random manner. You can easily expand this, by adding image urls to the images array

<!DOCTYPE html>
<html>
    <head>
        <script type="text/javascript">
            var p = {
                onload: function() {
                    setInterval(p.switchImage, 10000);
                },
                switchImage: function() {
                    document.getElementById("image").src = p.images[Math.floor(Math.random() * p.images.length)];
                },
                images: ["http://www.schoolplaten.com/afbeelding-hond-tt20990.jpg", "http://www.schoolplaten.com/afbeelding-hond-tt19753.jpg"]
            };
        </script>
    </head>
    <body onload="p.onload()">
        <img src="http://www.schoolplaten.com/afbeelding-hond-tt20990.jpg" id="image"/>
    </body>
</html>

1

solved switching between pictures randomally [closed]