Okay okay, you're going to want to use code similar to what MeEtc posted, but there's a bit of a problem see:
<body style="backgroundImage = 'url(image.jpg)'">
For that to work properly, you'd need to supply the page with a list of images, or supply a way of using AJAX to retrieve the location of another image.
It'd be simpler to have a file image.php which gives you the random image. So it'd be backgroundImage = 'url(image.php)'. And image.php would be like
code:
// generate location to random image
header ("Location: <pathtorandomimage>");
.
Then, you'd have (wherever you wanted the refresh button to go):
<input type="submit" onClick="getimage(); return 0;" /> and use MeEtc's script to get image.php again.