Hello - JavaScript newbie here,
I am tring to load a random background image & colour. (The image is aligned to the left of the page and the background colour is needed to match the image)
I am able to load the random background image
But, can not get the background colour working.
Here is what I have so far:
random_number= Math.floor(Math.random()* 3+1 );
var mycol=“#4c5d40”;
if (random_number==1) {
image=“images/img-1.jpg”;
}
if (random_number==2) {
image=“images/img-2.jpg”;
mycol=“#249a88”
document.bgColor=(myCol)
}
if (random_number==3) {
image=“images/img-3.jpg”;
}
// End –>
</SCRIPT>
</head>
<body onload=“document.body.background = image”>