javascript dynamic function call undefined
<h1>The function savefromtextarea() &amp; varialbe globe is undefined wen called on click of save button...</h1>

<p>This one part of my code...I need to access the save from texarea method when clicked on the save text button...when I try to invoke the saveFromTextArea method its throws globe is undefined but globe variable is global variable ...</p>

<pre><code>    ME.ZFP.annotaion.Text = function () { //function to annotate the text

var canvas = myscreen.getTempCanvas().ele;
var context = canvas[0].getContext('2d');
var global = this;

$(canvas).mousedown(function(e){ //on mouse down event 

    if ($('#textAreaPopUp').length === 0) {

        var mouseX = e.pageX - this.offsetLeft + $(canvas).position().left;
        var mouseY = e.pageY - this.offsetTop;

        //append a text area box to the canvas where the user clicked to enter in a comment
        var textArea = "&lt;div id='textAreaPopUp' style='position:absolute;top:"+mouseY+"px;left:"+mouseX+"px;z-index:30;'&gt;&lt;input type='text' id='textareaTest' &gt;&lt;/input&gt;";
     //Click on save buttom global.saveTextFromArea undefined
        var saveButton = "&lt;input type='button' value='save' id='saveText' onclick='global.saveTextFromArea("+mouseY+","+mouseX+");'&gt;&lt;/div&gt;";
        var appendString = textArea + saveButton;
        $("#container").append(appendString);
    } 
});
//Function to be called 
this.saveTextFromArea = function(y,x){
        //get the value of the textarea then destroy it and the save button
        var text = $('textarea#textareaTest').val();
        $('textarea#textareaTest').remove();
        $('#saveText').remove();
        $('#textAreaPopUp').remove();

}

   }
</code></pre>

<p>Thanks
Ajain</p>
