I have this webpage with many ads. Currently I have them appearing in a random order without repeating each time the page is refreshed. The code for that is here..
<div id="ads">
<script type="text/javascript">
var i, images = [];
// insert ads here
images.push("<img src='Images/xxxxx.jpg' alt='' />");
images.push("<img src='Images/xxxxx.jpg' alt='' />");
images.push("<a href='http://www.xxxxx.com' target='_blank'><img src='Images/xxxx.jpg' alt='' title='Visit www.xxxxx.com' /></a>");
images.push("<a href='http://www.xxxxxx.com' target='_blank'><img src='Images/xxxxxxx.jpg' alt='' title='Visit www.xxxxxxx.com' /></a>");
images.push("<img src='Images/xxxxxx.jpg' alt='' />");
images.push("<img src='Images/xxxxxx.jpg' alt='' />");
images.push("<a href='http://www.xxxxxxx.com/' target='_blank'><img src='Images/xxxxxx.jpg' alt='' title='Visit www.xxxxxx.com' /></a>");
images.push("<a href='http://www.xxxxxx.com' target='_blank'><img src='Images/xxxxxx.jpg' alt='' title='Visit www.xxxxxx.com' /></a>");
images.push("<a href='http://www.xxxxxx.com' target='_blank'><img src='Images/xxxxxx.jpg' alt='' title='Visit www.xxxxxx.com' /></a>");
images.push("<img src='Images/xxxxxx.jpg' alt='' />");
images.push("<a href='http://www.xxxxxx.ca' target='_blank'><img src='Images/xxxxxx.jpg' alt='' title='Visit www.xxxxxx.ca' /></a>");
images.sort(function()
{
return 0.5 - Math.random();
});
for(var i = 0; i < images.length; i++)
{
document.write(images[i]);
}
</script>
</div>
what I need to do now is group these ads by size, and randomize them within their group as well as randomize the groups each time the page is refreshed.
I hope I have explained this clearly and that someone can help me out. Thanks.