追加のテキストフィールドとラジオボタン:のため、私は3つのラジオボタンを持っているJavaScriptの
- 手当
- 授業
- 学校
私は手当のラジオボタンをクリックした場合、それが開きますul
リスト
は今、手当のためのラジオボタンは、私が「フルでない授業料」のラジオボタンをクリックすると、私はお金のためのテキストフィールドに入力することになっています授業料
のラジオボタンをクリックした後に閉じる必要がありますが、それはその上で閉じます。
「完全な授業料ではない」をクリックした後、それが閉じないようにしたいので、私はMoneyテキストフィールドに値を入力できます。
学校のラジオボタンをクリックすると、これも終了します。
これを動作させるにはどうすればよいですか?
function Allowance(select) {
if (select.value == 'Allowance') {
document.getElementById('allowance').style.display = "block";
} else {
document.getElementById('allowance').style.display = "none";
}
}
function Tuition(select) {
if (select.value == 'Tuition Fee') {
document.getElementById('tuition_fee').style.display = "block";
} else {
document.getElementById('tuition_fee').style.display = "none";
}
}
function Supply(select) {
if (select.value == 'School Supply') {
document.getElementById('school_supply').style.display = "block";
} else {
document.getElementById('school_supply').style.display = "none";
}
}
function Not_Full(select) {
if (select.value == 'Not Full') {
document.getElementById('Not_Full').style.display = "block";
} else {
document.getElementById('Not_Full').style.display = "none";
}
}
<input type="radio" name="ship_need" value="Allowance" id="test" onchange="Allowance(this)"> Allowance<br>
<div id="allowance" style="display: none;">
<ul>
<li>Food Allowance</li>
<li>Transportation Allowance</li>
</ul>
<label class="control-label">Money:</label>
<input type="text">
</div>
<input type="radio" name="ship_need" value="Tuition Fee" id="test" onchange="Tuition(this)"> Tution<br>
<div id="tuition_fee" style="display: none;">
<ul>
<li>Tuition Fee</li>
<input type="radio" name="test1" value="Full"> Full Tuition Fee<br>
<input type="radio" name="test1" value="Not Full" id="test" onchange="Not_Full(this)"> Not Full Tuition Fee<br>
</ul>
<div id="Not_Full" style="display: none;">
<label class="control-label">Money:</label>
<input type="text">
</div>
</div>
<input type="radio" name="ship_need" value="School Supply" id="test" onchange="Supply(this)"> School
<div id="school_supply" style="display: none;">
<ul>
<li>Books</li>
<li>Uniform</li>
</ul>
<label class="control-label">Money:</label>
<input type="text">
</div>
はい先生そのworking.Thisは私の説明の私が本当にwant.Maybeあなたの混乱しているが、あなたの変更は非常にcorrect.Thankあなたです。 – Chee
お手伝いします! :) –