Get value from textbox based on checkbox on change event
<p>I have two textboxes and one checkbox in a form.
I need to create a function javascript function for copy the first txtbox value to second textbox on checkbox change event.</p>

<p>I use the following code but its shows null on first time checkbox true.</p>

<pre><code>function ShiptoBill()
{
  var billing = document.getElementById("txtbilling").value;
  var shipping = document.getElementById("txtshipping").value;
  var check = // here i got checkbox checked or not
  if(check == true)
  {
    // here I need to add the txtbilling value to txtshipping
  }

}
</code></pre>