Identifying the id of current visible div
<p>I am working with 3 divs at the moment - on pageLoad the default is viewed but when the user clicks on a button the div is hidden and the selected div appears in its place. </p>

<p>How would I write an if statement to identify the div currently selected by the user? For example:</p>

<pre><code>if selected_div is 'dpara' then ....

else if selected_div is dtab then ....
</code></pre>

<p>Thanks in advance!</p>

<pre><code>    &lt;script type='text/javascript'&gt;
        function arrange(div_id) {
            // First make all the divs hidden...
            divs = document.getElementsByTagName('div');
            for( var i = 0; i &lt; divs.length; i++ ) {
                divs[i].style.display = 'none';
            }

            // Now make the one we want to be visible visible...
            document.getElementById(div_id).style.display = 'block';
        }
    &lt;/script&gt;
    &lt;form&gt;
        &lt;input type='button' value='dpara' onclick='arrange(this.value);' /&gt;
        &lt;input type='button' value='dtab' onclick='arrange(this.value);' /&gt;
        &lt;input type='button' value='ddl' onclick='arrange(this.value);' /&gt;
    &lt;/form&gt;
    &lt;div id='dpara'&gt;
    &lt;/div&gt;

    &lt;div id='dtab' style='display: none'&gt;
    &lt;/div&gt;

    &lt;div id='ddl' style='display: none'&gt;
    &lt;/div&gt;
</code></pre>
