View Single Post
  #2 (permalink)  
Old Sep 1st, 2007, 16:48
Rakuli's Avatar
Rakuli Rakuli is offline
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: dual random image genetator...tricky

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>
Reply With Quote