title: JavaScript string replace in textarea
body: <p>I'm trying to create a simple page that "corrects" YouTube's old embed code so that it works in PowerPoint 2010. If I hard code the embed code into a textarea on the page, it works fine, but if the user pastes the embed code into the text area, the javaScript doesn't seem to run.</p>
  
  <p>Take a look here:<a href="http://jsfiddle.net/pch8N/" rel="nofollow">http://jsfiddle.net/pch8N/</a></p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>&lt;p&gt;Click the button to "fix" the old embed code&lt;/p&gt;
  
  &lt;textarea rows="10" cols="60" id="demo"&gt;&lt;/textarea&gt;
  &lt;br/&gt;
  
  &lt;script&gt;
  function myFunction()
  {
  var str=document.getElementById("demo").innerHTML; 
  var n=str.replace(/\/\/www.youtube/g,"http://www.youtube").replace(/version=3/g,"version=2");
  document.getElementById("demo").innerHTML=n;
  }
  &lt;/script&gt;
  
  &lt;button onclick="myFunction()"&gt;Try it&lt;/button&gt;
  </code></pre>
  
  <p>Thanks for the help!</p>