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>

관련자료

댓글 0
등록된 댓글이 없습니다.
Today's proverb
삶은 짐이 아니다. 우리는 자기 내면에 혼란을 일으킴으로써, 또 끝없이 과거를 생각하고 미래를 위한 계획에만 몰두함으로써, 그리고 현재를 생각하지 않음으로써 삶을 짐으로 만든다. (바바하라다스)