Hi
I have this script that brings up a random jpeg image (in this case it is a red box, yellow box and blue box). Thats great.
Thing is, I want it to have a line of text underneath it that says "Red", "Yellow" or "Blue"
I'm sure this is easy to do, but I've had a few month away from web design and i'm forgetting everything i've learned.
Thanks
Code:
<head>
<title></title>
</head>
<body >
<script>
<!--
var pic, alt;
pic = new Array;
pic[0] = "red.jpg";
pic[1] = "yellow.jpg";
pic[2] = "blue.jpg";
alt = new Array;
alt[0] = "This is a picture of red";
alt[1] = "This is a picture of yellow";
alt[2] = "This is a picture of blue";
var now = new Date();
var seed = now.getTime() % 0xffffffff;
function rand(n) {
seed = (0x015a4e35 * seed) % 0x7fffffff;
return ( seed >> 16 ) % n;
}
var num2 = rand(3);
document.write("<a href='" + pic[num2] + "' ><img alt='" + alt[num2] + "' name='main_image' src='" + pic[num2] + "' width='125' border='0' ></a>");
//-->
</script>
</body>