
Melvosh
User
Sep 27, 2002, 9:05 AM
Post #4 of 4
(46016 views)
|
Re: [fashimpaur] Random cell background image
[In reply to]
|
Can't Post
|
|
fash, It's probably not the most elegant solution, but it works for my purposes. It totally screws up in Netscape 4.7, but it did that before, since Netscape likes to tile td background images. And usage of Netscape around here is declining, and is almost nil in our department. (This is not intended to start a flame war on browsers, it's just my opinion.) Anyway, here's the code: <script type="text/javascript"> <!-- var bg_Array = ["cracked_varnish", "glass", "grad1", "palette_knife", "radial_sweep", "ripple", "spatter", "sponge", "sprayed_strokes", "vortex"]; function rand(max) { return Math.round(Math.random() * max); } document.write("<style type='text/css'> td.bgp { background-image: url('/cemqa/images/460x65_" + bg_Array[rand(bg_Array.length)] + ".jpg'); background-repeat: no-repeat; background-position: center center;} </style>"); // --> </script> If you can come up with something better, or have a suggestion on getting Netscape not to tile the td bg image, I'd love to hear it. Thanks. "...there's some good in this world, Mr. Frodo, and it's worth fighting for." - Samwise Gamgee, The Two Towers
|