Javascript GET

A quick non-library way to safely look for a GET value and do something with it.

<script type="text/javascript">
  function getURLParameter(name) {
     return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(||[,""])[1].replace(/\+/g, '%20'))||null;
//look for and grab the value of  ?EMAIL
begotten = getURLParameter('EMAIL');
if (!!begotten) {
  //it exists so do something with it ... like send it to a form field id
  document.getElementById('edit-submitted-email').value = begotten;