Insert hyperlink and remove hyperlink in Javascript
<p>I want to create 2 simple button look like:
<img src="http://i.stack.imgur.com/1IAlZ.png" alt="http://i.stack.imgur.com/1IAlZ.png"></p>

<p>For insert and remove hyperlink to my HTML in textarea.</p>

<p>My code is:</p>

<pre><code>function formatDoc(sCmd, sValue) {  
  oDoc = document.getElementById("textBox");
  document.execCommand(sCmd, false, sValue); oDoc.focus(); 
}  
</code></pre>

<p>and on body :</p>

<pre><code>&lt;div&gt;&lt;img class="intLink" title="Hyperlink" onclick="var sLnk=prompt('Inserire lURL','http://');if(sLnk&amp;&amp;sLnk!=''&amp;&amp;sLnk!='http://'){formatDoc('createlink',sLnk)}" src="link.gif" /&gt;&lt;/div&gt;
&lt;textarea id="textBox"&gt;&lt;p&gt;Lorem ipsum&lt;/p&gt;&lt;/textarea&gt;
</code></pre>

<p>But that can't create and add Hyperlink to my element.
What is wrong?</p>

<p>ps: is there simple way to remove link from element?</p>
