라디오(radio)버튼 클릭한 값을 input text에 출력하는 방법
<input type="radio" name="aa" value="하하" onClick="document.getElementById('bb').value=this.value"> 하하
<input type="radio" name="aa" value="호호" onClick="document.getElementById('bb').value=this.value"> 호호
<input type="text" size="10" name="bb" value="">
또는
<script>
function chk(val) {
document.getElementById("bb").value = val;
}
</script>
<input type="radio" name="aa" value="하하" onClick="chk(this.value)"> 하하
<input type="radio" name="aa" value="호호" onClick="chk(this.value)"> 호호
<input type="text" size="10" name="bb" value="">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script>
<!--
function checkfunction()
{
with(document.all)
{
for(i=0; i<a.length; i++)
{
if(a[i].checked==true)
{
content.value = a[i].value;
}
}
}
}
//-->
</script>
</HEAD>
<BODY>
<input type='radio' name='a' value='가' onclick='javascript:checkfunction()'> 가
<input type='radio' name='a' value='나' onclick='javascript:checkfunction()'> 나
<input type='text' name='content'>
</BODY>
</HTML>