If these table cells will be the only two, you could simply add ID's to them and modify their background image.. Your script would look like
- Code: Select all
<script type="text/javascript" language="JavaScript">
NumberOfImagesToRotate = 2;
FirstPart = 'url (images/back';
LastPart = '.jpg)';
index ='t';
r = Math.ceil(Math.random() * NumberOfImagesToRotate);
function printImage() {
//after loading the id's into variables you could almost get rid of the
//second function
tableCell1.style.backgroundImage = FirstPart + r + LastPart;
tableCell2.style.backgroundImage = FirstPart + r + index + LastPart;
}
//-->
</script>