简体   繁体   English

无法运行javascript公共功能

[英]unable to run javascript public function

Hi I am createing Canvas CreateJS based drag and drop quiz, the error is when I drop any object then I need to run a function goback() which is available in that class but I dn't know why it's not accessible. 嗨,我正在创建基于Canvas CreateJS的拖放测验,错误是当我放下任何对象时,我需要运行该类中可用的功能goback(),但我不知道为什么它不可访问。

http://www.fltech.in/canvas/dragndrop/ http://www.fltech.in/canvas/dragndrop/

Because in your dropbox function, this no longer refers to the outside scope. 因为在您的dropbox函数中,所以this不再引用外部作用域。 You can change all this.a = to var a , and use goback() directly in dropbox rather than using this.goback() . 你可以改变所有this.a =var a ,并使用goback()直接在dropbox ,而不是使用this.goback()

You can refer to http://ryanmorr.com/understanding-scope-and-context-in-javascript/ for more information about this in javascript. 您可以参考http://ryanmorr.com/understanding-scope-and-context-in-javascript/有关详细信息, this在JavaScript。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM