Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #17117
| Message-ID | <3146546.DgNIzRijUK@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2012-11-10 11:45 +0100 |
| Subject | Re: calling a class prototype function from an onclick event |
| Newsgroups | comp.lang.javascript |
| References | <a31cb12d-0408-4298-814a-8cf5c7b41d79@googlegroups.com> |
| Followup-To | comp.lang.javascript |
Followups directed to: comp.lang.javascript
Tom wrote: > I have a problem that I need help solving. I have a class that implements > an onclick event on an element within an html document. The problem is > that I have to call a member function within the class object. While I can > access all of the class variables I cannot access the prototyped functions > for that class. Does anybody have a work around or a suggestion? Below is > an example where I have tried to remove all the fluff from the object to > show the nuts and bolts of what I am trying to do. Any suggestions would > be greatly appreciated. Your problem appears to be solved, so eventually you should know that there are no classes. So there are no class objects, class variables, or member functions in these programming languages. They use prototype-based, not class-based, inheritance. There are constructors, constructor properties (properties of constructors), and prototype methods (methods of prototype objects). > The problem area is in function ratings.prototype.addData. See? No classes, but prototype objects (here: referred by `ratings.prototype') attached to constructors (here: referred by `ratings') instead, from which other objects inherit. Because `ratings' refers to a constructor, the identifier should be `Ratings' instead. PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
calling a class prototype function from an onclick event Tom <gigasoftpeople@gmail.com> - 2012-11-09 08:32 -0800
Re: calling a class prototype function from an onclick event Scott Sauyet <scott.sauyet@gmail.com> - 2012-11-09 11:06 -0800
Re: calling a class prototype function from an onclick event Tom <gigasoftpeople@gmail.com> - 2012-11-09 15:08 -0800
Re: calling a class prototype function from an onclick event Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-10 11:45 +0100
Re: calling a class prototype function from an onclick event John G Harris <john@nospam.demon.co.uk> - 2012-11-11 11:39 +0000
csiph-web