[Prototype-core] Re: document.getElementByClassName appends undefined elements

2007-07-03 Thread JonTec

[2] Was a highly informative post. I'm a novice with javascript (I've
been around it a while, but only recently began using it heavily and
by itself for my pages). I had no idea that arrays could indeed be
used like this (I came from an explicit-type language like VB.NET and
then to Ruby (which has hashes)), I thought that the loop was over the
elements of the array with an index. I will take a look at #each and
thanks for clearing that up.

[Resolved]

On Jul 3, 1:49 am, Andrew Dupont [EMAIL PROTECTED] wrote:
  for(element in elements) {

 That's the problem. Use elements#each [1] or a for loop with an index
 to iterate through arrays. You can read more about this issue here
 [2].

 Cheers,
 Andrew

 [1]http://prototypejs.org/api/enumerable/each
 [2]http://andrewdupont.net/2006/05/18/javascript-associative-arrays-cons...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: document.getElementByClassName appends undefined elements

2007-07-02 Thread Andrew Dupont

 for(element in elements) {

That's the problem. Use elements#each [1] or a for loop with an index
to iterate through arrays. You can read more about this issue here
[2].

Cheers,
Andrew

[1] http://prototypejs.org/api/enumerable/each
[2] 
http://andrewdupont.net/2006/05/18/javascript-associative-arrays-considered-harmful/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---