How can I open a div onselectedindexchanged in JavaScript
<p>I have 2 div's in my page. one is open on page load, and the another one should open on selecting dropdown list item. I have written the javascript for that, but the problem coming is when I click on submit button, the first div  is opening.</p>

<p>My javascript as follows:</p>

<pre><code>function opendiv() {
    if ((document.getElementById("ddlistuser").value == "IP Address") &amp;&amp; (document.getElementById("ipadd").style.display == "none"))
    {
        document.getElementById("username").style.display = "none";
        document.getElementById("ipadd").style.display = "block";
        document.getElementById("ddllist").value = "IP Address";
    } else if ((document.getElementById("ddllist").value == "Username") &amp;&amp; (document.getElementById("username").style.display == "none"))
    {
        document.getElementById("username").style.display = "block";
        document.getElementById("ipadd").style.display = "none";
        document.getElementById("ddlistuser").value = "Username";
    }
}
</code></pre>
