Hi,

Can you put together a minimalist, self-contained example that
demonstrates the problem and post it to jsbin.com or jsfiddle.net or
something? (You can't use document.write there, but you can append
paragraphs to the page or some such.)

BTW, your code to loop through the `aPlaylist` array isn't quite right
(but I don't think that's the actual problem). If you use `for..in` to
loop through the array's elements, you have to do some checks because
arrays can have properties other than array indexes, which will break
your code. Details here:
http://blog.niftysnippets.org/2010/11/myths-and-realities-of-forin.html

Fundamentally, I don't see a problem other than the above with what
you've quoted. Seems to work:
http://jsbin.com/ulesa4

HTH,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On Mar 28, 3:21 pm, Björn Bartels <bbd...@googlemail.com> wrote:
> hi there,
>
> i know this is generic JS und it is only occuring in IE7, but i hope you can
> help me though...
>
> i have an array/list of objects like
>
> [
>     {
>         name : 'blah blah',
>         mp3 : 'http://server.tld/song.mp3',
>         ....
>     },
>     .....
> ]
>
> when i do a for-in loop over such an object, i get its keys and values as it
> should be...
>
> but, the next line, when i try to access the objects' properties 'directly'
> like
>
>     oTrack.mp3    or     oTrack['mp3']
>
> all IE(7) outputs is a unsatisfying 'undefined'... (please, see the code
> below for further details)
>
> any ideas anyone, please?
>
> YT
> BB
>
> <code>
>
> for ( iTrack in aPlaylist ) {
>
> var oTrack = aPlaylist[iTrack];
>
> for ( mData in oTrack ) {
>
>  document.write('' + iTrack + ', ' + mData + ', ' + oTrack[mData] + '<br />');
> // everything seems fine, all keys, all values
>
> }
>
> document.write('' + iTrack + ', ' + oTrack.mp3 + '<br />');    // nothing is
> fine, outputs 'undefined' for any property
> document.write('' + iTrack + ', ' + oTrack['mp3'] + '<br />'); // ...
>
> }
>
> </code>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to