<input type="text" id="first" value="some value">
<input type="text" id="second">
<input type="checkbox" id="copy">
<script>
document.getElementById('copy').onchange = function() {
var f = document.getElementById('first'),
s = document.getElementById('second');
s.value = this.checked ? f.value : '';
}
</script>