WEB制作のメモ帳
「javascript」で入力フォームを制限
- SOURCE
- ■javascript
function Dture(objId){
document.getElementById(objId).disabled = true;
}
function Dfalse(objId){
document.getElementById(objId).disabled = false;
}
■HTML
<input type="radio" name="reason" value="理由1" onclick="Dture('other_reason');" id="reason" />理由1
<input type="radio" name="reason" value="理由2" onclick="Dture('other_reason');" id="reason" />理由2
<input type="radio" name="reason" value="理由3" onclick="Dture('other_reason');" id="reason" />理由3
<input type="radio" name="reason" value="" onclick="Dfalse('other_reason');" id="reason" />その他
<input type="text" name="other_reason" id="other_reason" />