Here's a basic example to keep you going:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
*{margin:0px;padding:0px;}
#wrap{width:700px;padding:10px;margin:20px auto;border:3px double #777;
font-family:arial,serif,helvetica;
font-size:10pt;
}
#banner1{background:#9c0;height:50px;line-height:30px;text-align:center;}
#banner2{background:#930;height:50px;line-height:30px;text-align:center;color:#eee;}
#banner3{background:#eee;height:50px;line-height:30px;text-align:center;color:#222;}
</style>
<script type="text/javascript">
window.onload=function(){
var banner=['banner1','banner2','banner3'], // Set all of the banner in this array
rand=Math.floor(Math.random()*banner.length),
targ=document.getElementById('wrap').getElementsByTagName('div')[0];
targ.setAttribute('id',banner[rand]); // This is to randomly assign an id to our div
targ.onclick=function(){ var i=targ.id.split('banner')[1];
if(i==3) this.setAttribute('id','banner1');
else this.setAttribute('id','banner'+(Number(i)+1));
}
}
</script>
</head>
<body>
<div id="wrap">
<div id="banner1">
This is the text inside the banner.
</div>
</div>
</body>
</html>
Bookmarks