Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #17117

Re: calling a class prototype function from an onclick event

Path csiph.com!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!noris.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="ISO-8859-1"
Message-ID <3146546.DgNIzRijUK@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Organization PointedEars Software (PES)
Date Sat, 10 Nov 2012 11:45:26 +0100
User-Agent KNode/4.4.11
Content-Transfer-Encoding 7Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
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
MIME-Version 1.0
Lines 34
NNTP-Posting-Date 10 Nov 2012 11:45:26 CET
NNTP-Posting-Host a3a21096.newsspool2.arcor-online.net
X-Trace DXC=cR9Oill4b7UFm0Y?OE@2^XA9EHlD;3YcR4Fo<]lROoRQ8kF<OcfhCO[RLRX_FVNK>^DZm8W4\YJN\J`:FmdeL>KPiU3I74H>BYPoEg2;20]>2_
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:17117

Followups directed to: comp.lang.javascript

Show key headers only | View raw


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


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