inherit
Beware the ever changing head
33588
0
Nov 18, 2023 0:32:44 GMT -8
Ross
19,039
November 2004
elindir
|
Post by Ross on Aug 22, 2007 9:10:24 GMT -8
Header
This'll show a different background color or image each time the page is refreshed. Just list the image URLs or colors where shown in red. Each should be wrapped in quotation marks and seperated by a comma.
<script type="text/javascript"> <!--
/* random background image/color by ross of pbs - open source */
var backgrounds = new Array( "URL to Image", "URL to Image", "ff6600", "336699" // No comma on last line );
var bg = backgrounds[Math.floor(backgrounds.length * Math.random())]; var style = document.styleSheets.item(0);
if(style) { if(bg.match(/^http:/)) { var rule = "background-image: url(" + bg + ")"; } else { var rule = "background-color: #" + bg; } if(document.all) { style.addRule("body", rule); } else { style.insertRule("body { "+ rule +" }", 0); } }
//--> </script>
|
|