not able to toggle the visibilty of div in jsp based on user dropdown selection
<p>In my jsp when i select one option in the dropdown it works fine with visibilty toggle but when i try it out for second time on it doesnot work </p>

<p>my jsp :</p>

<pre><code>&lt;html&gt;
    &lt;head&gt;
    &lt;script src="javascript/display_toggle.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
    &lt;title&gt;IDOC AUTHORING TOOL&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;

    &lt;div id="BasePage"  style="display:block;" &gt;
    &lt;p&gt;
    &lt;u&gt; &lt;/u&gt;&lt;font size="7"&gt;&lt;u&gt;IDOC AUTHORING TOOL&lt;/u&gt;&lt;/font&gt;&lt;/p&gt;
    &lt;p&gt;&lt;/p&gt;
    &lt;p&gt;Enter/Choose ailment :
    &lt;select  size="1"&gt;
    &lt;option&gt;Malaria&lt;/option&gt;
    &lt;option&gt;High Fever&lt;/option&gt;
    &lt;option&gt;Cholera&lt;/option&gt;
    &lt;/select&gt;&lt;/p&gt;
    &lt;p&gt;Choose Authoring Mode :
    &lt;select size="1" name="AuthoringOption" id ="AuthoringOption" onchange="javascript:display_toggle()"&gt;
    &lt;option selected="selected"&gt; &lt;/option&gt;
    &lt;option value ="1"&gt;Input Desicion Tree&lt;/option&gt;
    &lt;option value ="2"&gt;Input Prevention&lt;/option&gt;
    &lt;option value ="3"&gt;Input Symptoms&lt;/option&gt;
    &lt;option value ="4"&gt;Input Prescription&lt;/option&gt;
    &lt;/select&gt;&lt;/p&gt;
    &lt;fieldset style="width: 381px; height: 126px; padding: 2"&gt;
        &lt;legend align="left"&gt;&lt;/legend&gt;
     Tick off patient context :
        &lt;input type="radio" value="V1" checked name="R1"&gt;Men
        &lt;input type="radio" name="R1" value="V2"&gt;Women
        &lt;p&gt;
        &lt;input type="radio" name="R1" value="V3"&gt; Child
        &lt;input type="radio" name="R1" value="V4"&gt; All&lt;/p&gt;
        &lt;/fieldset&gt;
    &lt;p&gt;Enter Pre Conditions&lt;/p&gt;
    &lt;p&gt;&lt;textarea rows="2" cols="20"&gt;&lt;/textarea&gt; 
    &lt;/div&gt; 


    &lt;!-- ______________________________________________________________________________________________________- --&gt;


    &lt;div id="Symptoms" style="display:none;"&gt;
    &lt;html:form method="POST" action="symptoms"  &gt;
    &lt;!-- --- --&gt;    
    &lt;p&gt;
    &lt;u&gt; &lt;/u&gt;&lt;font size="7"&gt;&lt;u&gt;IDOC AUTHORING TOOL&lt;/u&gt;&lt;/font&gt;&lt;/p&gt;
    &lt;p&gt;&lt;/p&gt;
    &lt;p&gt;Enter/Choose ailment :
    &lt;html:select name="AuthoringForm" property="disease_name" size="1"&gt;
    &lt;option&gt;Malaria&lt;/option&gt;
    &lt;option&gt;High Fever&lt;/option&gt;
    &lt;option&gt;Cholera&lt;/option&gt;
    &lt;/html:select&gt;&lt;/p&gt;
    &lt;p&gt;Choose Authoring Mode :
    &lt;select size="1" name="AuthoringOption" id ="AuthoringOption" onChange="javascript:display_toggle()"&gt;
    &lt;option selected="selected"&gt; &lt;/option&gt;
    &lt;option value ="1"&gt;Input Desicion Tree&lt;/option&gt;
    &lt;option value ="2"&gt;Input Prevention&lt;/option&gt;
    &lt;option value ="3"&gt;Input Symptoms&lt;/option&gt;
    &lt;option value ="4"&gt;Input Prescription&lt;/option&gt;
    &lt;/select&gt;&lt;/p&gt;
    &lt;fieldset style="width: 381px; height: 126px; padding: 2"&gt;
    &lt;legend align="left"&gt;&lt;/legend&gt;
     Tick off patient context :
    &lt;html:radio value="Men" name="AuthoringForm" property="patient_context" disabled="false"/&gt;Men 
    &lt;html:radio value="Womwen" name="AuthoringForm" property="patient_context" disabled="false"/&gt;Women
    &lt;p&gt;
    &lt;html:radio value="Child" name="AuthoringForm" property="patient_context" disabled="false"/&gt;Child
    &lt;html:radio value="Al" name="AuthoringForm" property="patient_context" disabled="false"/&gt;All
    &lt;/fieldset&gt;
    &lt;p&gt;Enter Pre Conditions&lt;/p&gt;
    &lt;p&gt;&lt;html:textarea rows="2" name="AuthoringForm" cols="20" property="patient_precondition" &gt;&lt;/html:textarea&gt;
    &lt;p&gt;Must Have Symptoms : 
    May Have Symptoms :&lt;/p&gt;
    &lt;p&gt;&lt;html:textarea rows="2" name="AuthoringForm" cols="20" property="must_have_symptoms"&gt;&lt;/html:textarea&gt;
    &lt;!-- &lt;input type="submit" value="Submit" name="B2"&gt;--&gt;
    &lt;html:textarea rows="2" name="AuthoringForm" cols="20" property="may_have_symptoms"&gt;&lt;/html:textarea&gt;
    &lt;input type="submit" value="Submit" name="symptomsButton"&gt;&lt;input type="reset" value="Reset" onclick="this.form.reset()"&gt;&lt;/p&gt;
    &lt;/html:form&gt;
    &lt;/div&gt;

    &lt;!--___________________________________________________________________________________________ --&gt;
    &lt;div id="Prevention" style="display:none;"&gt;
    &lt;html:form  method="POST" action="prevention"  &gt;

    &lt;!-- ---------------------------------- --&gt; 
    &lt;p&gt;
    &lt;u&gt; &lt;/u&gt;&lt;font size="7"&gt;&lt;u&gt;IDOC AUTHORING TOOL&lt;/u&gt;&lt;/font&gt;&lt;/p&gt;
    &lt;p&gt;&lt;/p&gt;
    &lt;p&gt;Enter/Choose ailment :
    &lt;html:select name="AuthoringForm" property="disease_name" size="1"&gt;
    &lt;option&gt;Malaria&lt;/option&gt;
    &lt;option&gt;High Fever&lt;/option&gt;
    &lt;option&gt;Cholera&lt;/option&gt;
    &lt;/html:select&gt;&lt;/p&gt;

    &lt;p&gt;Choose Authoring Mode :
    &lt;select size="1" name="AuthoringOption" id ="AuthoringOption" onChange="javascript:display_toggle()"&gt;
    &lt;option selected="selected"&gt; &lt;/option&gt;
    &lt;option value ="1"&gt;Input Desicion Tree&lt;/option&gt;
    &lt;option value ="2"&gt;Input Prevention&lt;/option&gt;
    &lt;option value ="3"&gt;Input Symptoms&lt;/option&gt;
    &lt;option value ="4"&gt;Input Prescription&lt;/option&gt;
    &lt;/select&gt;&lt;/p&gt;

        &lt;fieldset style="width: 381px; height: 126px; padding: 2"&gt;
        &lt;legend align="left"&gt;&lt;/legend&gt;
         Tick off patient context :
        &lt;html:radio value="Men" name="AuthoringForm" property="patient_context" disabled="false"/&gt;Men 
        &lt;html:radio value="Womwen" name="AuthoringForm" property="patient_context" disabled="false"/&gt;Women
        &lt;p&gt;
        &lt;html:radio value="Child" name="AuthoringForm" property="patient_context" disabled="false"/&gt;Child
        &lt;html:radio value="Al" name="AuthoringForm" property="patient_context" disabled="false"/&gt;All
        &lt;/fieldset&gt;

    &lt;p&gt;Enter Pre Conditions&lt;/p&gt;

        &lt;p&gt;&lt;html:textarea rows="2" name="AuthoringForm" cols="20" property="patient_precondition" &gt;&lt;/html:textarea&gt;


    &lt;!-- --------------------------------------------------- --&gt;   


        &lt;p&gt;Input for Prevention :
        &lt;/p&gt;
        &lt;p&gt;&lt;html:textarea rows="8" name="AuthoringForm" cols="79" property="prevention"&gt;&lt;/html:textarea&gt;
        &lt;input type="submit" value="Submit" name="preventionButton"&gt;&lt;input type="reset" value="Reset" onclick="this.form.reset()"&gt;
        &lt;/p&gt;
    &lt;/html:form&gt;
    &lt;/div&gt;


    &lt;!--____________________________________________________________________________________________ --&gt;




    &lt;div id="decisiontree" style="display:none;"&gt;

    &lt;html:form method="POST" action="decisiontree" &gt;
    &lt;!-- ------------------------------------------------ --&gt;
    &lt;p&gt;
    &lt;u&gt; &lt;/u&gt;&lt;font size="7"&gt;&lt;u&gt;IDOC AUTHORING TOOL&lt;/u&gt;&lt;/font&gt;&lt;/p&gt;
    &lt;p&gt;&lt;/p&gt;
    &lt;p&gt;Enter/Choose ailment :
    &lt;html:select name="AuthoringForm" property="disease_name" size="1"&gt;
    &lt;option&gt;Malaria&lt;/option&gt;
    &lt;option&gt;High Fever&lt;/option&gt;
    &lt;option&gt;Cholera&lt;/option&gt;
    &lt;/html:select&gt;&lt;/p&gt;

    &lt;p&gt;Choose Authoring Mode :
    &lt;select size="1" name="AuthoringOption" id ="AuthoringOption" onChange="javascript:display_toggle()"&gt;
    &lt;option selected="selected"&gt; &lt;/option&gt;
    &lt;option value ="1"&gt;Input Desicion Tree&lt;/option&gt;
    &lt;option value ="2"&gt;Input Prevention&lt;/option&gt;
    &lt;option value ="3"&gt;Input Symptoms&lt;/option&gt;
    &lt;option value ="4"&gt;Input Prescription&lt;/option&gt;
    &lt;/select&gt;&lt;/p&gt;

        &lt;fieldset style="width: 381px; height: 126px; padding: 2"&gt;
        &lt;legend align="left"&gt;&lt;/legend&gt;
         Tick off patient context :
        &lt;html:radio value="Men" name="AuthoringForm" property="patient_context" disabled="false"/&gt;Men 
        &lt;html:radio value="Womwen" name="AuthoringForm" property="patient_context" disabled="false"/&gt;Women
        &lt;p&gt;
        &lt;html:radio value="Child" name="AuthoringForm" property="patient_context" disabled="false"/&gt;Child
        &lt;html:radio value="Al" name="AuthoringForm" property="patient_context" disabled="false"/&gt;All
        &lt;/fieldset&gt;

    &lt;p&gt;Enter Pre Conditions&lt;/p&gt;
    &lt;p&gt;&lt;html:textarea rows="2" name="AuthoringForm" cols="20" property="patient_precondition" &gt;&lt;/html:textarea&gt;

    &lt;!-- ------------------------------------------------ --&gt;

        &lt;p&gt;
        &lt;/p&gt;
        &lt;fieldset style="width: 1225px; height: 451px; padding: 2"&gt;
        &lt;legend&gt;Decision Tree Preview &lt;/legend&gt;

    &lt;applet code="com.vaannila.utility.dynamicTreeApplet.class" archive="./appletjars/dynamictree.jar, ./appletjars/prefuse.jar" width ="1000" height="500"&gt;
    &lt;/applet&gt;
    &lt;/fieldset&gt;&lt;p&gt;

        &lt;/p&gt;
        &lt;p&gt;Enter Follow Up Questions :&lt;/p&gt;

        &lt;html:textarea rows="4" name="AuthoringForm" cols="45" property="follow_up_questions" &gt;&lt;/html:textarea&gt;
        &lt;html:radio value="Yes" name="AuthoringForm" property="followupconsent" disabled="false"/&gt; Yes
        &lt;html:radio  value="No" name="AuthoringForm" property="followupconsent" disabled="false"/&gt; No
        &lt;input type="submit" value="Submit" name="followupQuestionButton"&gt;&lt;input type="reset" value="Reset" onclick="this.form.reset()"&gt;&lt;p&gt;
        &lt;/p&gt;
    &lt;/html:form&gt;
    &lt;/div&gt;
    &lt;!--  ______________________________________________________________________________________________________________________________--&gt;

    &lt;div id="Prescription" style="display:none;"&gt;
    &lt;html:form  method="POST" action="prescription"  &gt;

    &lt;!-- ---------------------------------- --&gt; 
    &lt;p&gt;
    &lt;u&gt; &lt;/u&gt;&lt;font size="7"&gt;&lt;u&gt;IDOC AUTHORING TOOL&lt;/u&gt;&lt;/font&gt;&lt;/p&gt;
    &lt;p&gt;&lt;/p&gt;
    &lt;p&gt;Enter/Choose ailment :
    &lt;html:select name="AuthoringForm" property="disease_name" size="1"&gt;
    &lt;option&gt;Malaria&lt;/option&gt;
    &lt;option&gt;High Fever&lt;/option&gt;
    &lt;option&gt;Cholera&lt;/option&gt;
    &lt;/html:select&gt;&lt;/p&gt;

    &lt;p&gt;Choose Authoring Mode :
    &lt;select size="1" name="AuthoringOption" id ="AuthoringOption" onChange="javascript:display_toggle()"&gt;
    &lt;option selected="selected"&gt; &lt;/option&gt;
    &lt;option value ="1"&gt;Input Desicion Tree&lt;/option&gt;
    &lt;option value ="2"&gt;Input Prevention&lt;/option&gt;
    &lt;option value ="3"&gt;Input Symptoms&lt;/option&gt;
    &lt;option value ="4"&gt;Input Prescription&lt;/option&gt;
    &lt;/select&gt;&lt;/p&gt;

        &lt;fieldset style="width: 381px; height: 126px; padding: 2"&gt;
        &lt;legend align="left"&gt;&lt;/legend&gt;
         Tick off patient context :
        &lt;html:radio value="Men" name="AuthoringForm" property="patient_context" disabled="false"/&gt;Men 
        &lt;html:radio value="Womwen" name="AuthoringForm" property="patient_context" disabled="false"/&gt;Women
        &lt;p&gt;
        &lt;html:radio value="Child" name="AuthoringForm" property="patient_context" disabled="false"/&gt;Child
        &lt;html:radio value="Al" name="AuthoringForm" property="patient_context" disabled="false"/&gt;All
        &lt;/fieldset&gt;

    &lt;p&gt;Enter Pre Conditions&lt;/p&gt;

        &lt;p&gt;&lt;html:textarea rows="2" name="AuthoringForm" cols="20" property="patient_precondition" &gt;&lt;/html:textarea&gt;


    &lt;!-- --------------------------------------------------- --&gt;   


        &lt;p&gt;Input for Prescription :
        &lt;/p&gt;
        &lt;p&gt;&lt;html:textarea rows="8" name="AuthoringForm" cols="79" property="prescrption"&gt;&lt;/html:textarea&gt;
        &lt;input type="submit" value="Submit" name="prescriptionButton" &gt;&lt;input type="reset" value="Reset" onclick="this.form.reset()"&gt;

        &lt;/p&gt;
    &lt;/html:form&gt;
    &lt;/div&gt;
    &lt;/body&gt;
    &lt;/html&gt;
</code></pre>

<p>my javascript:</p>

<pre><code>function display_toggle(){
var e=document.getElementById("AuthoringOption").value;
if (e=="1"){
document.getElementById("Symptoms").style.display="none";
document.getElementById("Prevention").style.display="none";
document.getElementById("decisiontree").style.display="block";
document.getElementById("BasePage").style.display="none";
document.getElementById("Prescription").style.display="none";
}
else if(e=="2"){
document.getElementById("Prevention").style.display="block";
document.getElementById("decisiontree").style.display="none";
document.getElementById("Symptoms").style.display="none";
document.getElementById("BasePage").style.display="none";
document.getElementById("Prescription").style.display="none";
}
else if(e=="3"){
document.getElementById("decisiontree").style.display="none";
document.getElementById("Symptoms").style.display="block";
document.getElementById("Prevention").style.display="none";
document.getElementById("BasePage").style.display="none";
document.getElementById("Prescription").style.display="none";
}
else if(e =="4"){
document.getElementById("decisiontree").style.display="none";
document.getElementById("Symptoms").style.display="none";
document.getElementById("Prevention").style.display="none";
document.getElementById("BasePage").style.display="none";
document.getElementById("Prescription").style.display="block";
}
}
</code></pre>
