I found the solution for my own problem and i want to share:
I didn't find any script to make the background change dynamically but i found one for the background to change every time we reload the page and i tested it myself and it works perfectly.
<!-- TWO STEPS TO INSTALL RANDOM IMAGE:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!!
http://javascript.internet.com -->
<!-- Begin
// Set up the image files to be used.
var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.
theImages[0] = '1.gif'
theImages[1] = '2.gif'
theImages[2] = '3.gif'
theImages[3] = '4.gif'
// do not edit anything below this line
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'">');
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!!
http://javascript.internet.com -->
<!-- Begin
showImage();
</script>
<!-- Script Size: 1.49 KB -->
if you want to strech the background and have it 100% everytime on the page you can use this code:
Inside the <head></head>
<style type="text/css">
body {
margin: 0px;
}
#bg {
position: fixed;
margin: 0px;
border: 0px;
padding: 0px;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
overflow: hidden;
z-index: 0;
}
#bg img {
width: 100%;
}
#body {
text-decoration:none;
text-transform:none;
position:absolute;
width: 100%;
height:100%;
left: 0%;
top: 0%;
padding: 0%;
z-index: 0;
}
li {
margin-bottom: 0%;
}
</style>
<!--[if IE]>
<style type="text/css">
body {
margin: 0px;
overflow: hidden;
}
#body {
padding: 1em;
width: 100%;
height:100%;
overflow: auto;
}
</style>
<![endif]-->
Insite de <body></body>
<div id="bg"><SCRIPT LANGUAGE="JavaScript">
showImage();
</script> </div>
<div id="body">Your body content.</div>