title: Using innerHTML.replace to replace text to create link
body: <p>I'm using Sharepoint (WSS 3.0), which is unfortunately very limited in its ability to format survey questions (i.e., it strips any HTML you enter). I saw a solution elsewhere that suggested we add some JS to our master page file in order to allow line breaks. This works beautifully, but I'd like to see if we can allow links as well. </p>
  
  <p>In our WSS surveys, I can now use {{br}} anywhere I want a line break (this works). I have tried extending the code to allow the use of link tags (e.g., {{link1}}url{{link2}}URL Title{{link3}}; but, this doesn't work, presumably because the updates aren't happening as a whole, and the browser then tries to render it piece by piece, confusing it. (FF and IE show different results, but both fail. If I mix up the order of the JS below -- i.e., do link3, 2 and then 1 -- the output changes as well, but still fails.) Is there a better way to do this?</p>
  
  <hr>
  
  <pre><code>&lt;script language="JavaScript"&gt;
  var className;
  className = 'ms-formlabel';
  var elements = new Array();
  var elements = document.getElementsByTagName('td');
  for (var e = 0; e &lt; elements.length; e++)
  {
  if (elements[e].className == className){
  elements[e].innerHTML = elements[e].innerHTML.replace(/{{br}}/g,'&lt;br/&gt;');
  elements[e].innerHTML = elements[e].innerHTML.replace(/{{link1}}/g,'&lt;a href="');
  elements[e].innerHTML = elements[e].innerHTML.replace(/{{link2}}/g,'"&gt;');
  elements[e].innerHTML = elements[e].innerHTML.replace(/{{link3}}/g,'&lt;/a&gt;');}
  }
  &lt;/script&gt;
  </code></pre>