I see your point... I had discovered recently the lack of JavaScript knowledge. And since I mostly doing web development I realized that I am missing out a lot.
Unfortunately the object oriented approach JavaScript using is different from other object oriented languages I know (C++, C#, Java) So I am trying to get up to speed with JavaScript and making up my own problems/tasks. Like I am learning how 'this' works with JavaScript... So the code I wrote is not promoted by another library :) It's promoted by my background in C++ and C# mostly :) So I chose JQuery as a library to use but before I can freely start using it I want to understand how things work. Cause as of right now if you tell me to write JQuery from scratch I will not be ably even to start :) And even having full source available does not help much since I often do not understand what is going on Thanks George. On Nov 10, 12:50 pm, "Olivier Percebois-Garve" <[EMAIL PROTECTED]> wrote: > Well, using the pattern for plugin creation will make your life easier, and > "this" will make more sense. > Reading your code, it feels like you are using the structuration promoted by > another library > > > > On Mon, Nov 10, 2008 at 6:29 PM, George <[EMAIL PROTECTED]> wrote: > > > I had looked there probably 10 times :) > > Are you implying that I need to convert my code to being Plug-In? > > Other than that I do not see how this page > >http://docs.jquery.com/Plugins/Authoring > > answers my question... > > Sorry, but please spell it out for me. > > > The Plug-In would be the next step for me.. But as of now I am trying > > to nail down the use of 'this' in JavaScript as it's a bit different > > from what I am used to. > > > George. > > > On Nov 10, 11:43 am, "Olivier Percebois-Garve" <[EMAIL PROTECTED]> > > wrote: > > > you may want to have a look herehttp://docs.jquery.com/Plugins/Authoring > > > > On Mon, Nov 10, 2008 at 5:20 PM, George <[EMAIL PROTECTED]> wrote: > > > > > Being newbie in JavaScript I am trying to code my own helper object > > > > that does pagination. > > > > So here is a snippet of my code. > > > > > MyData.prototype = { > > > > ....blablabla... > > > > PageUp: function() { > > > > this.iFrom += this.pageSize; > > > > this.CheckPageIndex(); > > > > }, > > > > > CheckPageIndex: function() { > > > > if( this.iFrom >= this.data.length ) > > > > this.iFrom = Math.floor((this.data.length - 1)/ > > > > this.pageSize) * this.pageSize; > > > > > if( this.iFrom < 0 ) > > > > this.iFrom = 0; > > > > } > > > > > } > > > > > Why do I need to call CheckPageIndex using this.CheckPageIndex when > > > > called from PageUp? It's in the same object... > > > > > Without 'this' I get an error 'CheckPageIndex is undefined'. Coming > > > > from object oriented languages like C++ I have a trouble > > > > understanding > > > > it. > > > > Or am I doing it wrong and there is a way not to specify 'this' to > > > > many times? > > > > > Thanks > > > > George- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text -