title: Get URL parameter - sharepoint
body: <p>I am trying to extract an ID from my URL and paste it in the sharepoint List into the ID text box, I have tried it like that:</p>
  
  <pre><code>&lt;script type=”text/javascript”&gt;
  function GetQueryStringParams(sParam)
  {
      var sPageURL = window.location.search.substring(1);
      var sURLVariables = sPageURL.split('&amp;');
  
      for (var i = 0; i &lt; sURLVariables.length; i++)
      {
          var sParameterName = sURLVariables[i].split('=');
          if (sParameterName[0] == sParam)
              {
              return sParameterName[1];
              }
      }
  }​
     document.forms['aspnetForm'].ctl00_m_g_d9f5e4f9_7e05_4a4d_88b7_a6b1dcdda667_ctl00_ctl01_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField.value=GetQueryStringParams(‘ID’);
  &lt;/script&gt;
  </code></pre>
  
  <p>however it does not work, my URL:</p>
  
  <pre><code>http://Lists/Systems%20Survey/NewForm.aspx?Source=http://Lists/Systems%2520Survey/overview.aspx&amp;ID=14-01234
  </code></pre>
  
  <p>I have put it as a web part xml on my web. </p>
  
  <p>Do you have any idea what I did wrong? :)</p>
  
  <p>thanks for assistance </p>