joleencronin
IS-IT--Management
Hi,
I want to have a random background image on my page.
I have created the following function random() which calls a random image from a folder.
I then want to load this function when my pages loads, which i have done in the body tag.
the code i have written is posted below. please can you help to make it work??????
thanks
<html>
<head>
<script language=JavaScript> <!--
function random(){
document.body.style.background("<SRC='background/" + Math.ceil(Math.random() * 3) + ".jpg' WIDTH=1024 HEIGHT=634 BORDER=0 >")
//-->
}
</script>
<title>random background</title>
<body onLoad="random()">
</body>
</html>
I want to have a random background image on my page.
I have created the following function random() which calls a random image from a folder.
I then want to load this function when my pages loads, which i have done in the body tag.
the code i have written is posted below. please can you help to make it work??????
thanks
<html>
<head>
<script language=JavaScript> <!--
function random(){
document.body.style.background("<SRC='background/" + Math.ceil(Math.random() * 3) + ".jpg' WIDTH=1024 HEIGHT=634 BORDER=0 >")
//-->
}
</script>
<title>random background</title>
<body onLoad="random()">
</body>
</html>