Copy from list to textarea but prevent duplicates
<p>I have this code, it helps to select values from a list and pass them to a textarea but, I don't want to duplicate in case accidentally pressing the same list value.</p>

<p>Heres is what i got:</p>

<pre><code>window.onload = btnsInit;
function btnsInit()
{
  var i, a = document.getElementById('btns').getElementsByTagName('a');
  for (i = 0; i &lt; a.length; ++i) {
    a[i].onclick = btnClick;
  }
}
function btnClick(e)
{
  document.getElementById('ta').value += '' + this.firstChild.nodeValue + '\n';
  xPreventDefault(e);
  trim();
  return false;
}
function xPreventDefault(e)
{
  if (e &amp;&amp; e.preventDefault) e.preventDefault();
  else if (window.event) window.event.returnValue = false;
}
</code></pre>

<p>Any idea anyone?</p>

<p>Thank's</p>
