Earlier today I was thinking it'd be neat if i had a bunch of different color schemes on my site and each time you came to my site a color scheme was randomly chosen for you, so I got down to business and started to work on a script that would do this for me. I have everything set up for the background color and my logo pic. I was gonna continue onto applying to schemes to my links how they appear when your mouse goes over them and stuff when i noticed a problem. about 10% of the time the page is viewed everything goes crazy. the color scheme doesn't work, the random jokes section won't appear the joke of the day wont appear. but the other 9/10 times everything works fine. I thought I'd post it on the internet temporarily so you could see this for yourself. http://home.neo.rr.com/jokes4000/index2.html The script I made is
var abgc = new Array("hi","bye","good","bad");
var Z = abgc.length;
var bgc = Math.round(Math.random()*(Z));
if (bgc == 1){bgcA="red";};
if (bgc == 2){bgcA="yellow";};
if (bgc == 3){bgcA="white";};
if (bgc == 4){bgcA="fuchsia";};
document.bgColor=bgcA;
if (bgcA == "red"){document.logo.src="logo red.bmp"}
if (bgcA == "yellow"){document.logo.src="logo yellow.bmp"}
if (bgcA == "white"){document.logo.src="logo white.bmp"}
if (bgcA == "fuchsia"){document.logo.src="logo purple.bmp"}
What's going on and how do I fix it?






tomaine2002 posted this at 19:59 — 5th May 2004.
They have: 83 posts
Joined: Apr 2004
nvm this post i was able to edit the script and get everything working alright again (yeah!).