Can I call instance function when using jQuery
<p>I have 2 methods, one is internal method and the other one is instance method,
When I'm calling my internal function(<code>onkeydown="javascript:return checkChatBoxInputKey();"</code>) it works great,<br>
But when I'm trying to activate the <code>onclick</code> event (<code>onclick="this.CloseChatBox();</code>) I get the following error:</p>

<blockquote>
  <p>0x800a01b6 - Microsoft JScript runtime error: Object doesn't support
  property or method 'CloseChatBox'</p>
</blockquote>

<p>Here is my code:</p>

<pre><code>function ChatBox(){
    // Methods
    this.CloseChatBox = ChatBox.CloseChatBox;

    // Adding new chat box to page
    $(" &lt;div /&gt;").attr("id", "chatbox")
    .html('&lt;div class="chatboxhead"&gt;' +                                                    
          '&lt;a href="javascript:void(0)" title="Close chat box" onclick="this.CloseChatBox();"&gt;X&lt;/a&gt;' + // This line fails to work
                    '&lt;/div&gt;' +
                    '&lt;div class="chatboxbody"&gt;' +
                            '&lt;textarea onkeydown="javascript:return checkChatBoxInputKey();"&gt;&lt;/textarea&gt;' +
                    '&lt;/div&gt;')
    .appendTo($("body"));

    $("#chatbox_" + this.CallId).show();

    return true;}

function checkChatBoxInputKey(){
    alert("checkChatBoxInputKey");}

ChatBox.CloseChatBox = function (){
    alert("CloseChatBox");}
</code></pre>

<p>What can I do?</p>
