var a=Math.round(Math.random() * 3); var backColor = ['#FF9999', '#3399FF', '#CC6633', '#0FA494']; document.getElementById('page_background').style.background = backColor[a] + ' url(top'+(a+1)+'.png)';