title: How do I capture a url parameter from parent page and send to an iframe using Javascript?
body: <p>I have an iframed form placed on a landing page. When users come to this landing page from an affiliate link, a parameter is placed in the url (http:thelandingpage.com?c3=1). When they submit the iframe form, I need to send that variable (c3=1) to the next page. How could I achieve that?</p>
  
  <p>Here is the option I'm exploring:<br/>
  <b>Pulling the parameter from the parent page url</b><br/>
  <em>Note: this code is being placed inside the iframe</em> <br/>
  (Javascript)</p>
  
  <pre><code>&lt;script language="JavaScript"&gt;
    function processUser()
    {
      var parameters = window.parent.location.search.substring(1).split("&amp;");
  
      var temp = parameters[0].split("=");
      c3 = unescape(temp[1]);
  
      //Assign "c3=" to a var
      var c3variable = c3;
  
      //Append c3 Variable
      document.getElementById("c3").innerHTML = c3variable; 
  
    }
  processUser();
  
  
  &lt;/script&gt; 
  </code></pre>
  
  <p>(HTML)</p>
  
  <pre><code>&lt;strong&gt;If variable displays, that's a success!&lt;/strong&gt;
  &lt;br&gt;
  c3: &lt;span id="c3"&gt;&lt;/span&gt;&lt;br&gt;
  </code></pre>
  
  <p>Of course it's not working properly though. It displays the first parameter in the iFrame's "src", not the first parameter of the parent page.</p>
  
  <p>I can't move on until I grab the "c3=1" parameter.. But my next step would be to stick that variable in a hidden field or something in order to send it to the next page as a query string.</p>
  
  <p>Please help!</p>