Je suis pas bien sur d'avoir compris, mais pas à pas ça donne ça :
<script type="text/javascript">
var fond = new Array("url(img/soldat1.jpg)", "url(img/soldat2.jpg)", "url(img/soldat3.jpg)");
window.onload = function (){
if (document.getElementById('centrale').style.backgroundImage == "url(img/soldat1.jpg)") {
var rand = Math.floor(Math.random() * fond.length);
document.getElementById('centrale').style.backgroundImage=fond[rand];
}
</script>
Mais c'est pas très logique car dans ce cas là l'image soldat1.jpg ne sert strictement à rien, juste ça ne suffirais pas? :
<script type="text/javascript">
var fond = new Array("url(img/soldat1.jpg)", "url(img/soldat2.jpg)", "url(img/soldat3.jpg)");
window.onload = function (){
var rand = Math.floor(Math.random() * fond.length);
document.getElementById('centrale').style.backgroundImage=fond[rand];
}
</script>
/code