Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Louloul
    New Member
    • Aug 2010
    • 7

    Help

    Please I want help from you. I am doing project, I wrote a code html/javascript where this code works when I select an option this option is related to a fieldset where this fieldset(that include radio options) should be on and the other fieldsets should be off
    Here is the code
    Code:
    <html>
    <head>
      <title>Registration</title>
    </head>
    <head>
    <script type="text/javascript">
    function choose_a()
    {
     var x= document.getElementsByName("level").selectedIndex;
           
            if (x == document.getElementById("1"))
     {
      document.l.E[0].disabled=true;
    document.l.E[1].disabled=true;
    document.l.E[2].disabled=true;
    document.l.S[0].disabled=true;
    document.l.S[1].disabled=true;
    document.l.S[2].disabled=true;document.l.S[3].disabled=true;
    document.l.S[4].disabled=true;
    document.l.S[5].disabled=true;
    document.l.S[6].disabled=true;
    document.l.S[7].disabled=true;
    document.l.S[8].disabled=true;
    
    
        }
    
    
     }
     else
     if (x == document.getElementById("2"))
     {
      document.l.k.disabled="true";document.l.se.disabled="true";
     
     }
     else
     if (x == document.getElementById("3"))
     {
     
      document.l.k.disabled="true";document.l.el.disabled="true";
      
     }
     
    }
    
    </script>
    
    
    </head>
     
    <body>
    <form method="post" action="" name=L>
        <table border="1" align="center"><Caption><h1>Registratiopn New Year</h1></caption>
        <tbody>
          <tr><td colspan="2" align=center>Level</td>
          </tr>
     
          <tr>
             <td colspan=2 align=center><select name="level">
              <option selected id="1" onClick=choose_a();>
                Kinder Garden
              </option>
     
              <option id="2" onClick=choose_a();>
                Elementary
              </option>
     
              <option id="3"onClick=choose_a();>
                Secondary
              </option>
            </select></td>
          </tr>
     
          <tr>
            <td colspan="2" align=center>Class</td>
          </tr>
     
          <tr>
            <td colspan=2 align=center>
              <fieldset name=k>
                <legend id=A>Kinder Garden</legend><input dir="ltr" value="1" checked type="radio" name="kg">Nursery<br> 
       <input dir="ltr" value="2" type="radio" name="kg">KG1<br><input dir="ltr" value="3" type="radio"
                name="kg">KG2<br>
              </fieldset>
            </td>
          </tr>
       <tr><td colspan=2 align=center>   
            <fieldset name=el><legend id=B>Elementary</legend>
              <input type="radio" name="E " dir="ltr" value="1">First<br><input type="radio" name="E " dir="ltr" value="2">Second<br>
              <input type="radio" name="E " dir="ltr" value="3">Third<br><input type="radio" name="E " dir="ltr" value="4">Fourth<br>
              <input type="radio" name="E " dir="ltr" value="5">Fifth<br><input type="radio" name="E " dir="ltr" value="6">Sixth<br>
              <input type="radio" name="E " dir="ltr" value="7">Seventh<br><input type="radio" name="E " dir="ltr" value="8">Eeigth<br>
              <input type="radio" name="E " dir="ltr" value="9">Ninth
            </fieldset>
          </td>
         </tr>
       
        <tr>
          <td colspan="2" align=center>
            <fieldset name=se><legend id=C>Secondary</legend>
              <input type="radio" name="S" value="1">Second
       <input type="radio" name="S" value="2">Bac1
                   <select name="Bac1"><option value="1" SELECTED>Sientific</option>
                                <option value="2">Literal</option>
                   </select>
             <input type="radio" name="Bac2" value="3">Bac2
                  <select name="Bac2"><option value="1" SELECTED>Socio Economic</option>
                               <option value="2">Life Science</option>
                                      <option value="3">General Science</option>
                  </select>
             </fieldset>
          </td>
        </tr>
       
        <tr>
          <td><input type="submit" name="Submit" value="Register" width="100%" height="100%"></td>
          <td><input type="reset" name="Reset" value="Clear" width="100%" height="100%"></td>
       </tr>
        </tbody>
      </table>
      </form>
    </body>
    </html>
    Looking forward for hearing from you
    Thanks
    Last edited by gits; Aug 23 '10, 09:42 AM. Reason: added code tags
Working...