Forum Moderators: open
<html>
<head>
<title>random Masthead background</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript">
//Edit this line to list all of your background images
var backgroundSrcs = new Array("images/header1.jpg","images/header2.jpg","images/header3.jpg","images/header4.jpg")
function pickimage()
{
//This line picks an image at random from the list you entered above
var bgimage=backgroundSrcs[(Math.round(Math.random()*(backgroundSrcs.length-1)))]
//This line applies the background image to your masthead
document.getElementById("masthead").style.backgroundImage = "url('" + bgimage + "')";
}
</script>
<style>
#masthead{
position:absolute;
top:0px;
left:0px;
width:100%;
height:104px;
border: 1px solid blue;
}
</style>
</head>
<body onload="pickimage()">
<div id="masthead">
<p>Your Masthead Goes Here</p>
</div>
</body>
</html>
Unfortunately anyone using it should be told to get a browser that works.
does the function just not get called or does it misbehave in some way?