このサイトがaspのみであるかどうかはわかりませんが、どちらを選択したかに基づいて子フィールドが無効または有効になるフォームを作成しようとしています. チェックボックスでできましたが、ドロップダウンの選択値で動作させたいです。ここにリンクと以下のスクリプトがあります:
http://www.rfdesignstudio.com/newsite/paypal.html
選択スクリプトは次のとおりです。
<select name="type" class="input" id="type" onchange="type()">
<option value="General">General</option>
<option value="Walk-a-thon">Walk-a-thon</option>
</select>
関数スクリプトは次のとおりです。
function type(){
if (document.getElementById('type').value=='Walk-a-thon') {
document.getElementById('child').disabled = false;
document.getElementById('teacher').disabled = false;
document.getElementById('room').disabled = false;
}
else {
document.getElementById('child').disabled = true;
document.getElementById('teacher').disabled = true;
document.getElementById('room').disabled = true;
document.getElementById('child').value = "";
document.getElementById('teacher').value="";
document.getElementById('room').value="";}
}