So I am new to HTML. I have a webpage that contains only a picture in its background; with each refresh, a new image is loaded. However, I want to use that webpage link as in the Image element so anyone can use that image in their webpage, I know < iframe > tag can be done for this task but I can not use it, due to some reason.
some what similar to this :http://placeimg.com/640/480/people
<body id="testing" onLoad="randompicture()">
<script>
function randompicture(){
const i = Math.floor(Math.random() * 5) + 1;
const path='images/image' +i+ '.png';
console.log(path)
document.getElementById("testing").setAttribute("style", "background-image: url(" + path +");background-repeat: no-repeat;background-size: 388px 388px");
}
</script>
</body>