Random Background (JavaScript Animation)
Random Background (JavaScript Animation)
Get a random background color with the touch of a button. This JavaScript uses 15
pre-determined background colors and then randomly chooses one. This is a great
effect if you know what background colors don't interfere with the text on your
page. Then, you can make them the 15 pre-determined background colors.
<!-- Begin
function rnd(scale) {
var dd=new Date();
return((Math.round(Math.abs(Math.sin(dd.getTime()))*1000000000)%scale));
}
function show() {
document.blah.bg.value=document.bgColor;
document.blah.fg.value=document.fgColor;
}
document.fgColor=256*rnd(255)+16*rnd(255)+rnd(255);
document.bgColor=256*rnd(255)+16*rnd(255)+rnd(255);
// End -->
</SCRIPT>