체크하면 텍스트박스로 데이터가 가는것..^^ 정보
체크하면 텍스트박스로 데이터가 가는것..^^본문
강호동
위의 텍스트박스에 체크박스 체크를 하면 위처럼 강호동이라고 써졌으면 좋겠는뎅..
어떻게해야하졍,..ㅠ
!!
위의 텍스트박스에 체크박스 체크를 하면 위처럼 강호동이라고 써졌으면 좋겠는뎅..
어떻게해야하졍,..ㅠ
!!
댓글 전체
좀 가르쳐주세요..ㅠ~!!ㅠㅠㅠ
<script>
function val_in(el, t_el) { // el : this, t_el : target
if (typeof t_el == 'string') t_el = document.getElementById(t_el);
if (t_el == null) return false;
t_el.value= el.value;
}
</script>
<label><input type="radio" name="s" value="강호동" onclick="val_in(this, 's2')"> 강호동</label>
<input type="text" name="s2" id="s2">
걍 간단하게 인라인으로 ㅋ.
function val_in(el, t_el) { // el : this, t_el : target
if (typeof t_el == 'string') t_el = document.getElementById(t_el);
if (t_el == null) return false;
t_el.value= el.value;
}
</script>
<label><input type="radio" name="s" value="강호동" onclick="val_in(this, 's2')"> 강호동</label>
<input type="text" name="s2" id="s2">
걍 간단하게 인라인으로 ㅋ.
헐 감사합니다!!!!!최고~!
아쿠아님 ㄳ 근데 <label><input type="radio" name="a" value="강호동2" onclick="val_in(this, 's2')"> 강호동2</label> 를 추가해서 강호동에 클릭하고 강호동 2에 클릭하면
강호동 강호동2 가 텍스트로 나오게 할수있는방법이없을까요..ㅠㅠ!!
강호동 강호동2 가 텍스트로 나오게 할수있는방법이없을까요..ㅠㅠ!!
t_el.value= el.value;
요 부분을
if (t_el.value == '') t_el.value = el.value;
else t_el.value += ' ' + el.value;
이렇게 ㅋ......
요 부분을
if (t_el.value == '') t_el.value = el.value;
else t_el.value += ' ' + el.value;
이렇게 ㅋ......
헐..감사합니다!!!유용하게쓸꼐요!!