单选按钮逻辑-JavaScript

时间:2018-11-06 20:54:13

标签: javascript html

我需要为一组单选按钮添加逻辑:

使用JavaScript修改注册表格,以使用户无法以无效的组合注册研讨会。

以下是规则:

第1天

会议1

车间A

车间B –涵盖第1场和第2场,因此,如果有人选择B,则第2场中的任何研讨会都不会被选择。

车间C

会议2

车间D

Workshop E

车间F –如果他们拿F,他们还必须拿H(不是G或I)

第2天

会议3

车间G

H车间–除非他们签署了F合同,否则不能接受H

我的车间

注意:如果用户选择Workshop B,那么他们不仅不能选择Session 2的任何研讨会,而且Workshop H是无效的选择。

<fieldset>
<legend><b>Workshop Registration</b></legend>
<br>

<label for="CSV"><b>Session 1 - Advanced Horror</b></label>
<br>
<fieldset id="group1">
<input type="radio" id="A" value="1" name="group1" required /><label for="A">The Nature of Horror: What Scares Us and Why</label>
<br>
<input type="radio" id="B" value="1" name="group1"/><label for="B">Writing Scary: Techniques for Maximum Horror Effect</label>
<br>
<input type="radio" id="C" value="1" name="group1"/><label for="C">Monsters: The Things that Go Bump in the Night</label>
<br>
</fieldset>
<br>

<label for="CSV"><b>Session 2 - Sci-Fi and Fantasy</b></label>
<br>
<fieldset id="group2">
<input type="radio" id="D" value="1" name="group2" required /><label for="D">Kick Your Scene Into Action</label>
<br>
<input type="radio" id="E" value="1" name="group2"/><label for="E">Naming People and Places</label>
<br>
<input type="radio" id="F" value="1" name="group2"/><label for="F">Dystopia Now!</label>
<br>
</fieldset>
<br>

<label for="CSV"><b>Session 3 - Mystery and Thriller</b></label>
<br>
<fieldset id="group3">
<input type="radio" id="G" value="1" name="group3" required /><label for="G">Writing the Mystery Series</label>
<br>
<input type="radio" id="H" value="1" name="group3"/><label for="H">Plotting a Thriller</label>
<br>
<input type="radio" id="I" value="1" name="group3"/><label for="I">Six Steps to Writing Unputdownable Suspense</label>
<br>
</fieldset>
<br>
<div></div>
</fieldset>

我对此并不陌生,因此不确定如何开始使用JavaScript。谁能帮助我朝正确的方向发展?

谢谢!

0 个答案:

没有答案