title: Using a checkbox to show entered values in a field to another field when a check box is clicked
body: <p>Html - Delivery address has to give the entered value to  billing address. The javascript and html are in separate files</p>
  
  <p>Other js features are working fine, but its just this one that doesn't seem to work</p>
  
  <pre><code>&lt;div class="textinput"&gt;
      &lt;label for="deladdress"&gt;Delivery Address: &lt;/label&gt;
      &lt;input id="deladdress" type="text" name="Delivery Address" /&gt;
  &lt;/div&gt;
  &lt;div id="buttoncheckarea"&gt;
      &lt;input id="CheckDelivery" type="checkbox" name="CheckDelivery"&gt;
      &lt;label id="diff" for="CheckDelivery"&gt;Same as delivery address?&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="textinput"&gt;
      &lt;label for="postcode"&gt;Postcode: &lt;/label&gt;
      &lt;input id="postcode" type="text" name="postcode" /&gt;
  &lt;/div&gt;
  &lt;div class="textinput"&gt;
      &lt;label for="billaddress"&gt;Billing Address: &lt;/label&gt;
      &lt;input id="billaddress" type="text" name="Billing Address" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>javascript</p>
  
  <pre><code>function deliveryfunc() {
      var delivery = document.getElementById("deladdress").value;
      var billing = document.getElementById("billaddress").value;
      //var checkbox = document.getElementById("CheckDelivery").checked;
      if (document.getElementsByName("CheckDelivery").checked == true) {      
          billing = delivery;
      }
  }
  
  function init () {  
      var order = document.getElementById("ordForm");
      order.onsubmit = ordervalidation;   
      order.onclick = radiobuttoncheck;
      var checkbutton = document.getElementsByName("CheckDelivery");
      checkbutton.onclick = deliveryfunc;
  }
  
  window.onload = init;
  </code></pre>