ThakurSuraj1991 0 Newbie Poster
   on click of Stream radio button the corresponding year should b displayed..
   And on click of year the corresponding subjects should be displayed..
   But it doesnt workk..!!
    Plz help......

This is my script:

<script type="text/javascript">
function get_value_year()
{
var rad_val="";

for (var i=0; i < document.userform.myStream.length; i++)
   {
   if (document.userform.myStream[i].checked)
      {
        rad_val = document.userform.mySrteam[i].value;
        break;
      }
    }

    document.write();

    if(rad_val=="CS")
    {
        document.getElementById('YearCS').parentNode.style.display = 'block';
        document.getElementById('YearIT').parentNode.style.display = 'none';
    }
    if(rad_val=="IT")
    {
        document.userform.getElementById('YearIT').parentNode.style.display = 'block';
        document.userform.getElementById('YearCS').parentNode.style.display = 'none';
    }
}
</script>


This is the html Code:
<div class="one_fourth last" > 
        <div class="bloc rounded" style="height:680px; WIDTH:685PX"> 
            <form name="userform" method="post" action="AdmissionSubmit.jsp" onsubmit="return check();">
            <h3></h3>  

                    <font size="7">Admission Form</font>
                    <br><br>                  
                    <fieldset>
                    <legend><span><font size="4">Educational Details</font></span></legend>
                    <br><br>
                    <br><br><br><br>

                    <DIV id="stream" onclick="get_value_year()" style="LEFT: 30px; POSITION: absolute; TOP: 100px; HEIGHT: 29px">
                        <br><br>       Stream:
                        <input type="radio" title="Choose from one of the options" value="CS" name="myStream" id="mystream">BSc CS  <br>
                                        <input type="radio" title="Choose from one of the options" name="myStream" value="IT" id="mystream" /><font color="white">BSc IT</font>
                    </div>

                    <div id="YearCS" style="Display:none; LEFT: 170px; POSITION: absolute; TOP: 100px; HEIGHT: 29px" onclick="get_radio_value()">
                        <DIV id="YearCS" >
                            <BR><br>Year:
                             <input type="radio" name="year" value="YEAR1 CS" id="myYear" />F.Y.BSc<br>
                                            <input type="radio" name="year" value="YEAR2 CS" id="myYear" />S.Y.BSc       <br>
                                             <input type="radio" name="year" value="YEAR3 CS" id="myYear" />T.Y.BSc       
                        </div>
                    </div>

                    <div style="Display:none">
                        <DIV id="SemIT" style="LEFT: 160px; POSITION: absolute; TOP: 100px; HEIGHT: 29px" onclick="get_radio_value()">
                            <br><br>Year:
                            <input type="radio" name="year" value="SEM1 IT" id="myYear" />F.Y.BSc
                            <input type="radio" name="year" value="SEM2 IT" id="myYear" />S.Y.BSc<br>     
                               <input type="radio" name="year" value="SEM3 IT" id="myYear" />T.Y.BSc
                            <input type="radio" name="year" value="SEM4 IT" id="myYear" />F.Y.BSc<br>   
                                        <input type="radio" name="year" value="SEM5 IT" id="myYear" />S.Y.BSc
                            <input type="radio" name="year" value="SEM6 IT" id="myYear" />T.Y.BSc       

                        </div>
                    </div>

                    <div style="Display:none">
                        <DIV id="Sem1" style="LEFT: 280px; POSITION: absolute; TOP: 100px; HEIGHT: 29px" onclick="get_radio_value()">
                                    <br><br>
                                    Subjects :

                                        <input type="checkbox" name="subj" value="Math1" id="mySem1" />MATHEMATICS 1
                                        <br>                                         <input type="checkbox" name="subj" value="FDC" id="mySem1" />FUND. OF DIGITAL COMPUTATION
                                        <br>                                          <input type="checkbox" name="subj" value="ECT" id="mySem1" />ELECT. & COMMUNICATIOIN TECH.
                                        <br><input type="checkbox" name="subj" value="PHP" id="mySem1" />PHP
                                        <br>                 <input type="checkbox" name="subj" value="C++" id="mySem1" />C++ PROGRAMING
                        </DIV>
                    </DIV>



                    <div style="Display:Block">
                        <DIV id="Sem2" style="LEFT: 330px; POSITION: absolute; TOP: 100px; HEIGHT: 29px" onclick="get_radio_value()">
                                    <br><br>
                                    Subjects :

                                        <input type="checkbox" name="subj" value="Math2" id="mySem2" />MATHEMATICS 2
                                        <br>                <input type="checkbox" name="subj" value="WebT" id="mySem2" />Web Technology
                                        <br>              <input type="checkbox" name="subj" value="Mup" id="mySem2" />Microprocessor
                                        <br>                            <input type="checkbox" name="subj" value="DCN" id="mySem2" />Digital Computer & N/W
                                        <br><input type="checkbox" name="subj" value="DBMS" id="mySem2" />DBMS
                        </DIV>
                    </DIV>
                    </fieldset>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.