Html & Script

라디오버튼으로 활성화/비활성화/마지막텍스트박스활성

페이지 정보

본문

http://cnecons.com/htm.html



////////////////////////////
readonly 속성 지정으로 라디오 버튼 클릭시 텍스트박스가 고정이 되고
기타클릭(readonly 속성 해제시) 이전 라디오버튼이 비활성화되고
텍스트박스가 활성화됩니다.

<script Language="Javascript">

function form_check(f) {
if(f.num['0'].checked) {
f.money.value='5000'
f.money.readOnly = true; // readonly 속성 지정
} else if(f.num['1'].checked) {
f.money.value='10000'
f.money.readOnly = true; // readonly 속성 지정
} else if(f.num['2'].checked) {
f.money.value='15000'
f.money.readOnly = true; // readonly 속성 지정
} else if(f.num['3'].checked) {
f.money.value='20000'
f.money.readOnly = true; // readonly 속성 지정
} else if(f.num['4'].checked) {
f.money.value='25000'
f.money.readOnly = true; // readonly 속성 지정
} else if(f.num['5'].checked) {
f.money.value='30000'
f.money.readOnly = true; // readonly 속성 지정
} else if(f.num['6'].checked) {
f.money.value='금액을 기입해주세요'
f.money.readOnly = false; // readonly 속성 해제
}
}
</script>

<form>
<input type="radio" name="num" value="0" onclick="form_check(this.form)">1개월
<input type="radio" name="num" value="1" onclick="form_check(this.form)">2개월
<input type="radio" name="num" value="2" onclick="form_check(this.form)">3개월<br>
<input type="radio" name="num" value="3" onclick="form_check(this.form)">4개월
<input type="radio" name="num" value="4" onclick="form_check(this.form)">5개월
<input type="radio" name="num" value="5" onclick="form_check(this.form)">6개월<br>
<input type="radio" name="num" value="6" onclick="form_check(this.form)">날입금액<br><br>
내용 : <input type=text name="money" size="25" onfocus="this.select()" >
</form>

관련자료

등록된 댓글이 없습니다.
Today's proverb
시간은 우리각자가 가진 고유의 재산이요. 유일한 재산이다. 그것을 어떻게 사용할 것인지 결정할 수 있는 것은 오로지 우리 자신뿐이다. 결코 그 재산을 남이 우리 대신 사용하지 않도록 조심해야 한다.