Javascript checkbox 컨트롤
소스
<html>
<head>
<title></title>
<meta name="generator" content="editplus" />
<meta name="author" content="zzarungna" />
<style type="text/css">
body { font-size:12px; }
input { border:1px solid black; }
#cb1 {border:0px; }
#txtName1, #txtName2 { width:50px; }
#txtAddress1, #txtAddress2 { width:30px; }
hr {width:200px; color:black; text-align:center;}
</style>
<script type="text/javascript">
function Copy()
{
//텍스트박스1.value
//alert(document.getElementById("txtName1").value = "택배지렁");
//체크박스 체크0
//alert(document.getElementById("cb1").checked);
if (document.getElementById("cb1").checked)
{
document.getElementById("txtName2").value = document.getElementById("txtName1").value;
document.getElementById("Address2").value = document.getElementById("Address1").value;
}
}
</script>
</head>
<body>
<!-- Ex13.htm -->
<h3>주문자 정보</h3>
이름 : <input type="text" id="txtName1" /> <br />
주소 : <Input type="text" id="Address1" />
<hr />
<input type="checkbox" id="cb1" onclick="Copy();" /><label for="cb1">받는 사람이 주문자와 동일합니다.</label>
<hr />
<h3>수령인 정보</h3>
이름 : <input type="text" id="txtName2" /> <br />
주소 : <Input type="text" id="Address2" />
</body>
</html>
결과