title: Changing Iframe src dynamically
body: <p>I am getting value from localstorage and want to pass it to the url in iframe.
  I am trying this code</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;script&gt;
    // getting value from localstorage
  
    var x = localStorage.getItem("firstname");
    //alert showing the value 
  
    alert(x);
    //but this is not working.
    document.getElementById("framee").src = 'https://thingspeak.com/channels/' + x + '/charts/1?bgcolor=%23ffffff&amp;color=%23d62020&amp;dynamic=true&amp;results=60&amp;type=line&amp;update=15';
  &lt;/script&gt;
  
  &lt;body&gt;
  
    &lt;iframe id="framee"&gt;&lt;/iframe&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  
  
  <p>alert is showing me the value but when the next line is executed no frame is shown in on web. the question is how to pass the value in url so it can be a proper syntax. </p>