Simple background image randomizer

Mamat

by xaliber

HTML

<div id="container">
asdadsa
</div>

CSS

#container { width:300px; height:300px; color:#fff; }

JavaScript

var count = 3;
var image = new Array
    image[1] = "http://i.imgur.com/QeBWi4f.png",
    image[2] = "http://i.imgur.com/4rWgHtn.jpg",
    image[3] = "http://i.imgur.com/gLhSufH.jpg",
document.getElementById("container").style.backgroundImage = "url(" + image[Math.round(Math.random() * (count - 1)) + 1] + ")";