Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #16063
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | JJ <jaejunks_at@_googlemail_dot._com> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: referencing variable name for object in an array, receiving TypeError when using to set property of object |
| Date | Thu, 20 Sep 2012 22:56:25 +0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 44 |
| Message-ID | <XnsA0D53CE8D69C8jaejunksgooglemailco@0.0.0.89> (permalink) |
| References | <5f8cd44c-a554-42b4-bde5-5e099bdce516@googlegroups.com> |
| Injection-Date | Thu, 20 Sep 2012 22:56:25 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="f8ea35d8958493b8650c0b3ef1b6a34b"; logging-data="24856"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+X23WUPZuT4RDUQcIFpbQWjjwDEOdBm1c=" |
| User-Agent | Xnews/5.04.25 |
| X-Face | \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pad{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl |
| Cancel-Lock | sha1:nhBv/ImsrNkTpRzPVh94fvQdij8= |
| Xref | csiph.com comp.lang.javascript:16063 |
Show key headers only | View raw
Quaye Trimble <qtrimble@gmail.com> wrote: > This would probably be better described if I give you the link so you > can follow along. > > https://bccmws.coastal.edu/buoydata/buoyobs1.html > > The function initChart contains a single argument which defines the > time period of data to display . The function gets the data and > configures some of the chart options. Most of the chart options are > already defined in a separate js file. OK, so within this function, > I'm referencing a global object called dataArr which stores some > configuration information for querying the data and defining some > additional chart options. You can see how I'm constructing the object > on line 185 if you are using Firebug or something similar. If data is > returned I'm calling the function setChart and passing a bunch of > arguments into it. The first argument contains the variable name of > one of the external chart options object. Using the Firebug console, > the output is correct but I'm getting a TypeError. It's as if the > variable output isn't being used to define the chart option variable > name but it's like it wants the variable name to be a completely > different object. > > I'm not trained in JavaScript (or any programming language for that > matter) so I'm probably doing something that isn't allowed. > > Let me know if I need to clarify anything and thanks for your > willingness to help me. > > Quaye The "setChart" function expects its "theChartOptions" parameter to be an object. However, in "initChar" function where it calls "setChart", it passes a string as the "theChartOptions" parameter: setChart(dataArr[i].chartoptions,theDataObj,dataArr [i].cname,type,chartNo); Since "setChart" expects it to be one of the "optionsNN" object in the global context, then the call to "setChart" can be fixed like this: setChart(window[dataArr[i].chartoptions],theDataObj,dataArr [i].cname,type,chartNo);
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
referencing variable name for object in an array, receiving TypeError when using to set property of object Quaye Trimble <qtrimble@gmail.com> - 2012-09-20 10:51 -0700
Re: referencing variable name for object in an array, receiving TypeError when using to set property of object JJ <jaejunks_at@_googlemail_dot._com> - 2012-09-20 22:56 +0000
Re: referencing variable name for object in an array, receiving TypeError when using to set property of object Quaye Trimble <qtrimble@gmail.com> - 2012-10-10 05:28 -0700
csiph-web