How to write js function return innerHTML?
<p>I am trying to convert emoticon codes into emoticon images. I want to write it within a function. Here is original code without function yet :</p>

<pre><code>$.get("showMsgLive.php?username=" + str + "&amp;servertime=" + servertime + "&amp;usertime=" + usertime + "&amp;lastmsgID=" + lastmsgid, function(newitems){
    newitems = newitems.replace(/\(smile1\)/g, '&lt;img src="images/emoticons/emobasic/smile1.gif" class="emoticon"/&gt;')
    .replace(/\(rabbit18\)/g, '&lt;img src="images/emoticons/emospecial/rabbit18.gif" class="emoticon"/&gt;')
    .replace(/\(rabbit19\)/g, '&lt;img src="images/emoticons/emobasic/rabbit19.gif" class="emoticon"/&gt;')
    .replace(/\(rabbit20\)/g, '&lt;img src="images/emoticons/emoadvance/rabbit20.gif" class="emoticon"/&gt;')
    .replace(/\(sheep4\)/g, '&lt;img src="images/emoticons/emospecial/sheep4.gif" class="emoticon"/&gt;'); //end of special emo
    newitems.innerHTML = newitems;
    api.getContentPane().append(newitems);
}); 
</code></pre>

<p>Here is the code that I try to write it in function :</p>

<pre><code>function convertTextEmo(newitems){
    newitems = newitems.replace(/\(smile1\)/g, '&lt;img src="images/emoticons/emobasic/smile1.gif" class="emoticon"/&gt;')
    .replace(/\(rabbit19\)/g, '&lt;img src="images/emoticons/emospecial/rabbit19.gif" class="emoticon"/&gt;')
    .replace(/\(rabbit20\)/g, '&lt;img src="images/emoticons/emobasic/rabbit20.gif" class="emoticon"/&gt;')
    .replace(/\(sheep4\)/g, '&lt;img src="images/emoticons/emoadvance/sheep4.gif" class="emoticon"/&gt;'); //end of special emo
    return newitems;    
}

jQuery.get("showMsgLive.php?username=" + str + "&amp;servertime=" + servertime + "&amp;usertime=" + usertime + "&amp;lastmsgID=" + lastmsgid, function(newitems){
    convertTextEmo(newitems);
    api.getContentPane().append(newitems);  
}); 
</code></pre>

<p>I didn't put <code>innerHTML</code> in the function because I don't know where and how to put it, and the output didn't success convert the code into image. May I know where or how to put innerHTML in the function and return the value?</p>
