Click to See Complete Forum and Search --> : Script for random background in table...[help]


.dash.
05-27-2003, 08:44 AM
Hallo there,
iam looking for the script, that randomly sets background images in table without affecting other backgrounds on the page:
For example, i need a page that has its own background picture + that page schould have couple of tables with different background images and one "special" table with the randomly set background.

I have found some "background scripts" on i-net, but i coudnt make them to work a way i need (above):
changes background in Body tag (http://javascript.internet.com/bgeffects/r-images.html)

could somebody help me with it?
tnx

khalidali63
05-27-2003, 09:35 AM
Take a looksy..may be this will help you..

:p

http://68.145.35.86/skills/javascripts/RandomBGImageInTables.html

koeniepoenie
05-27-2003, 09:37 AM
maybe this will help?

<body bgcolor="#FFFFFF" text="#000000" Onload="randbg('numb1');">
<table>
<tr>
<td id='numb1' bgcolor="#009933">koen
in da house</td>
</tr>
</table>
<script language="Javascript" type="html/javascript">
function randbg(id) {
var img = new Array('1.gif','2.gif'); // add your images here..
var num = Math.round(Math.random() * (img.length - 1));
var pic = img[num];
eval(id+".background = '"+pic+"';");
}
</script>
</body>

grtz Koen

.dash.
05-27-2003, 09:45 AM
Thanks a lot khalidali63,
that was the thing i was looking for :D

koeniepoenie
05-27-2003, 09:48 AM
haha
just 2 minutes.. sorry khalidali63 I didn't see your post :D
grtz Koen

khalidali63
05-27-2003, 10:09 AM
You are welcome .dash

:D