Comment charger deux images différentes provenant de deux dossiers différents ?
Bonjour!!!
Je cherche à créer une page web qui affiche 1 image aléatoire piochée un premier dossier et une deuxième image aléatoire pris dans un deuxième dossier.
Voilà ce que j'utilise mais malheureusement la deuxième image ne s'affiche pas. Quelqu'un aurait.il une solution en JS?
Code:
1 2 3 4 5 6 7 8 9 10 11
| <script type="text/javascript">
function randomImg(){
document.getElementById('image').src = "CO/" + Math.round(Math.random()*4+1) + ".jpg";
}
</script>
<script type="text/javascript">
function randomImg1(){
document.getElementById('image').src = "Fond/" + Math.round(Math.random()*4+1) + ".jpg";
}
</script> |
Code:
1 2 3 4 5 6 7 8 9 10
| <body >
<body onload="randomImg()">
<img src="" id="image" / border=0 width=300 height=250>
</body>
<body onload="randomImg1()">
<img src="" id="image" / border=0 width=300 height=250>
</body>
</body > |
Un tout grand MERCI!!!!