Tag & Script/JavaScript

비활성화된 셀렉트박스를 체크박스 체크시 활성화 시키기

미련곰 2007. 8. 20. 15:33

<input type=text id=t>
<input type=checkbox onClick="if(this.checked){t.disabled=1}else{t.disabled=0}">

=======================================

<script>
function test(){
if(document.formname.check.checked){
document.formname.text.disabled=true;
//체크시 활성화
}else{
document.formname.text.disabled=false;
//체크시 비활성화
}
</script>

<html>
<form name=formname>
<input type=checkbox name=check onclick="javascript:test()">
<input type=text name=text disabled>
</form>
<html>

출처 : http://blog.naver.com/ljmgood123/37385259