Randomised division selection

Bit of an odd one.... How can I get a website to *random*ly select a division to show each time the page is loaded? I have absolutely no idea where to start.

     <div id="option1">Dog</div>
     <div id="option2">Cat</div>
     <div id="option3">Rabbit</div>



I would recommend doing something in Javascript.

When the body load you should tell Javascript either to remove the once you dont want or to create the one you want.


This will delete all divs but the one selected randomly.


    <script type="text/javascript" src="script.js"></script>

<body onload="load()">
    <div id="1">
    <div id="2">
    <div id="3">


function load() {   
    var amount_of_divs = 3;
    var random = Math.floor((Math.random()*amount_of_divs) + 1);

    for (var i = 1; i < amount_of_divs + 1; i++) {
       if(i == random)
       var div = document.getElementById(i);

Need Your Help

NSImage color shift on Snow Leopard

macos cocoa quartz-graphics

My app creates NSImages by compositing various other NSImages together. The original images are loaded from files using [NSBitmapImageRep imageRepWithContentsOfFile:]. The final image is then displ...