功能savefromtextarea()& varialbe全球未定义温家宝保存按钮的点击称为...
我的代码这一部分......我需要访问从texarea方法保存当在保存文本按钮点击...当我尝试调用saveFromTextArea方法及其引发地球是不确定的,但全球范围内的变量是全局变量...动态的JavaScript函数调用未定义
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 = "<div id='textAreaPopUp' style='position:absolute;top:"+mouseY+"px;left:"+mouseX+"px;z-index:30;'><input type='text' id='textareaTest' ></input>";
//Click on save buttom global.saveTextFromArea undefined
var saveButton = "<input type='button' value='save' id='saveText' onclick='global.saveTextFromArea("+mouseY+","+mouseX+");'></div>";
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();
}
}
感谢 阿然
我没有在任何地方看到'saveTextFromArea'(或'savefromtextarea')。你的问题和疑问到底是什么?显然你的代码示例并不完整,所以我们很难(如果不是不可能的话)来帮助你,因为有很多未知的东西。 *猜测*是浪费我们和你的时间。请创建一个http://jsfiddle.net/演示,其中显示了什么是错误的并澄清了您的问题。 – 2012-08-09 11:35:47
“动态调用”是什么意思?隐含的“静态调用”(不管那意味着什么)工作? – nnnnnn 2012-08-09 11:40:05
菲利克斯国王...请参阅修改后的代码.. – 2012-08-09 12:50:52