function billingFunction() {
if (document.getElementById('same').checked) {
var shipinfo = document.getElementById('shippingName').value;
var billinfo = document.getElementById('shippingZip').value;
document.getElementById('billingName').value = shipinfo;
document.getElementById('billingZip').value = billinfo;
} else {
document.getElementById('billingName').value="";
document.getElementById('billingZip').value="";
}
}
use this
solved Copy values if checkbox is checked