Saturday 15 February 2014

javascript - How can I access the super of the super class in JS? -


The code is very explanatory. What I am doing is wrong. How can I get an object's property on a declared object inside an object method?

  function A () {this.a = 0; }; Apriteit.mfan = function () {var b = document.getElementsByClassName ("myclassName"); B [0]. Click = Function (E) How do I get an object's property here? This.a = 1; }};   

Can I pass it some way as an argument ?!

  b [0] .onclick = function (e, this) {  

Since the context of the function of this function, you can do two things pass near the reference, or create a variable that you will not overwrite, this this

  indicates the function A (). {This.a = 0; }; A.prototype.myfun = function () {var self = this; Var b = document.getElementsByClassName ("myclassName"); B [0]. Click on = function (e) {shelf = 1; }};    

No comments:

Post a Comment