Call javascruot function on body load event… e.g. ”
var totalCount = 5;
function Test() {
// if (document.body) {
// document.body.style.backgroundImage = ‘url(images/slideshow1_1.jpg)’;
// }
var num = Math.ceil(Math.random() * totalCount);
if (num == 1) {
//document.bgColor = “Red”;
document.body.style.backgroundImage = ‘url(images/slideshow1_1.jpg)’;
}
else if (num == 2) {
//document.bgColor = “Yellow”;
document.body.style.backgroundImage = ‘url( images/slideshow1_2.jpg)’;
}
else if (num == 3) {
//document.bgColor = “Green”;
document.body.style.backgroundImage = ‘url(images/slideshow1_3.jpg)’;
}
else if (num == 4) {
//document.bgColor = “Blue”;
document.body.style.backgroundImage = ‘url(images/slideshow1_4.jpg)’;
}
else if (num == 5) {
//document.bgColor = “White”;
document.body.style.backgroundImage = ‘url(images/slideshow1_2.jpg)’;
}
}
this is my page
”
you can also use like this in javascript
var backImage = [
“images/bg0.png”,
“images/bg1.png”,
“images/bg2.png”,
“images/bg3.png”,
“images/bg4.png”,
“images/bg5.png”
];
function changeBGImage(whichImage) {
if (document.body){
document.body.style.backgroundImage = ‘url(‘+backImage[whichImage]+’)’;
}
}
download: https://skydrive.live.com/?cid=efc0ec2e2cd761ee&sc=documents&nl=1&uc=1&id=EFC0EC2E2CD761EE%21164#