75
rated 0 times
[
81]
[
6]
/ answers: 1 / hits: 34790
/ 11 Years ago, fri, november 22, 2013, 12:00:00
I'm writing a code to select a value from a drop-down list and the radio button will automatically checked itself according to the onClick attribute. The code worked both in Firefox and IE but not in Chrome.
This is the code for the drop-down list:
<select name=c_DOB_year id=c_DOB_year>
<option selected=selected>Year</option>
<option value=2008 onClick=document.getElementById('c_age_2').checked=true;>2008</option>
<option value=2009 onClick=document.getElementById('c_age_1').checked=true;>2009</option>
<option value=2010 onClick=document.getElementById('c_age_0').checked=true;>2010</option>
</select>
This is the code for the radio button:
<label>
<input type=radio name=c_age value=4 Years id=c_age_0 />
4 Years
</label>
<label>
<input type=radio name=c_age value=5 Years id=c_age_1 />
5 Years
</label>
<label>
<input type=radio name=c_age value=6 Years id=c_age_2 />
6 Years
</label>
What seems to be the problem? Hope someone can help me. Thanks. :D
More From » html