2018. 3. 5. 15:08ㆍJavascript/Javascript+jQuery
<script>
function FillBilling(f) {
if(f.billingtoo.checked == true) {
f.billingname.value = f.shippingname.value;
f.billingcity.value = f.shippingcity.value;
}
}
</script>
To add more fields, just add to the parameters shown above...like this:
f.billingstate.value = f.shippingstate.value;
f.billingzip.value = f.shippingzip.value;
The HTML for the form you will use looks like this:
<b>Mailing Address</b>
<br><br>
<form>
Name: <input type="text" name="shippingname">
<br>
City: <input type="text" name="shippingcity">
<br>
<input type="checkbox" name="billingtoo" onclick="FillBilling(this.form)">
<em>Check this box if Billing Address and Mailing Address are the same.</em>
<P>
<b>Billing Address</b>
<br><br>
Name: <input type="text" name="billingname">
<br>
City: <input type="text" name="billingcity">
</form>
<script type="text/javascript">
function allCheck() {
var checkboxes = document.getElementsByName('approve[]');
var button = document.getElementById('toggle');
if (button.value == 'select') {
for (var i in checkboxes) {
checkboxes[i].checked = 'FALSE';
}
button.value = 'deselect'
} else {
for (var i in checkboxes) {
checkboxes[i].checked = '';
}
button.value = 'select';
}
}
</script>
'Javascript > Javascript+jQuery' 카테고리의 다른 글
jQuery checkbox 컨트롤 (0) | 2018.03.21 |
---|---|
체크박스 전체선택,전체해제,선택반전, 체크박스 선택갯수 확인 및 값 확인 (0) | 2018.03.19 |
Onclick selection of textbox data (0) | 2018.03.10 |
TEXT to Clipboard on a Button-Click (0) | 2018.03.10 |
텍스트 복사 / 붙여넣기 자바스크립트 (0) | 2018.03.09 |