View Full Version : Update on refresh help

08-03-2006, 04:45 PM
Hi guys, I'm currently using the script below to have images updating on refresh there is a large image and then a smaller closeup image. So that if it loads lgrandomphoto1.gif in one div in the other div it also loads smrandomphoto1.gif

which works like a charm... BUT

Now in addition to the images pair changing there is also a short description div tag that needs to update or show depending on what image pair is displayed IE. 1,2,3,4,5... I also have another div tag that I just want to change the color of depending on what image pair is displayed....

<script type="text/javascript" language="javascript">
function swapPic() {
if(document.getElementById) {
var smLg, num = rnd(5);
for (var x=0; x<2; x++) {
smLg = (x) ? 'sm' : 'lg';
var thePicture = document.getElementById('rugimage'+smLg);
var picPath = smLg+'randomphoto/'+smLg+'randomphoto'+num+'.gif';
thePicture.style.background = 'url('+picPath+')';
function rnd(n) {
return Math.floor(Math.random() * n) + 1;