1
Colleagues
I would like each time the user accesses the site, a different image appears. I know how to do with PHP, but in this case I would like to do with javascript. I believe that the Math.(), but I don’t know much javascript. I tried to do it this way, but it didn’t work:
<script type="text/javascript">
function aleatorio(){
img[0] = "ciadeli.jpg";
img[1] = "ninashoes.jpg";
img[2] = "odonto.jpg";
var mudar = Math.floor(Math.random()*img.length);
document.getElementById("aleatorio").innerHTML = "<img src='portifolios/"+img[mudar]+"'>";
}
</script>
<div id="aleatorio" onload="aleatorio()"></div>
Perfect Marceloboni. Thank you!
– user24136