Kod:
<script type="text/javascript">function randomize(min, max) {
if (!min)
min = 0;
if (!max)
max = 1;
return Math.floor(Math.random()*(max+1)+min);
}
function randomBg() {
var bgs = new Array();
// I took these images from a site with a similar script already only to get example images
// I wrote this script myself
bgs.push("bg/bg.jpg");
bgs.push("bg/bg2.jpg");
bgs.push("bg/bg3.jpg");
bgs.push("bg/bg4.jpg");
bgs.push("bg/bg5.jpg");
document.body.style.backgroundImage = "url(" + bgs[randomize(0, bgs.length-1)] + ")";
}
</script>
Arka plan resmi 1 tane değil ekrana sığdığı kadar fazlalaşıyor. Bu yüzden non-repeating'i kodun neresine ekleyebilirim? Bilgisi olan lütfen yazsın.