I have a form that I am building for a client and I am trying to make it so when one group of radio buttons is selected, disable the list of checkboxes but if the radio button for the checkboxes is selected then clear the other radio buttons if他们被/被选中。
这是我正在使用的代码:
<form action="#">
<fieldset><legend>Activities</legend>
<input style="margin-right:0; margin-left:0;" type="radio" id="Golf" value="I would like to golf at The Breakers Ocean Course" name="activity" />
<label for="Golf">Golf - The Breakers Ocean Course</label>
<ul style="margin-top:0;">
<label for="club">Club Rental</label>
<input style="margin-right:0; margin-left:0;" type="radio" id="club-yes" value="Yes" name="clubrental" />
<label for="club-yes">Yes</label>
or
<input style="margin-right:0; margin-left:0;" type="radio" id="club-no" value="No" name="clubrental" />
<label for="club-no">No</label><br>
<input style="margin-right:0; margin-left:0;" type="radio" id="right-hand" value="Right Handed" name="clubhand" />
<label for="right-hand">Right Handed</label>
or
<input style="margin-right:0; margin-left:0;" type="radio" id="left-hand" value="Left Handed" name="clubhand" />
<label for="left-hand">Left Handed</label>
</ul>
<div style="clear:both;"> </div>
<input style="margin-right:0; margin-left:0;" type="radio" id="hometour" value="I would like to take the Home tour and Worth Avenue Shopping" name="activity" />
<label for="hometour">Home tour and Worth Avenue Shopping</label>
<div style="clear:both;"> </div>
<input style="margin-right:0; margin-left:0;" type="radio" id="museum" value="I would like to attend the Cars of Dreams Museum Tour" name="activity" />
<label for="museum">Cars of Dreams Museum Tour</label>
<div style="clear:both;"> </div>
<input style="margin-right:0; margin-left:0;" type="radio" id="spa" value="I would like to attend The Spa at the Breakers" name="activity" />
<label for="spa">Spa - The Spa at the Breakers</label>
<ul style="margin-top:5px;">
- Please select two treatments<br>
<div style="float:left; width:220px; margin-right:15px;">
<input type="checkbox" id="personal-retreat-massage" value="Personal Retreat Massage" name="treatment" onclick="setItems(this)">
<label for="personal-retreat-massage">Personal Retreat Massage</label>
</div>
<div style="float:left; width:220px; margin-right:15px;">
<input type="checkbox" id="simplicity-massage" value="Simplicity Massage" name="treatment" onclick="setItems(this)">
<label for="simplicity-massage">Simplicity Massage</label>
</div>
<div style="float:left; width:220px; margin-right:15px;">
<input type="checkbox" id="guerlain-classic-facial" value="Guerlain Classic Facial" name="treatment" onclick="setItems(this)">
<label for="guerlain-classic-facial">Guerlain Classic Facial</label>
</div>
<div style="float:left; width:220px; margin-right:15px;">
<input type="checkbox" id="cellular-enzyme-peel" value="Cellular Enzyme Peel" name="treatment" onclick="setItems(this)">
<label for="cellular-enzyme-peel">Cellular Enzyme Peel</label>
</div>
</ul>
</fieldset>
<center><input style="width:75px; height:25px; margin-bottom:25px;" type="submit" value="Submit" name="submit"></center>
</form
> 我不能使用 PHP,所以这只能是 Javascript。
谢谢你。