- differences between jet and odbc
- sugarcrm not inserting email
- select random records from access
- button click event firing twice
- how to send an email using cdosys
- installing perl on win2003 64 bit
- asp.net page event order
- rewrite rule for subdomains only
- extra items in javascript array
- IE7 margin auto not working
- IE7 border style dotted glitch
- ByRef and ByVal in vbscript
- weather rss feed
- Classic asp crib sheet
- Firefox onsubmit image change
- limit records in access
- AccessDataSource is thick
- double margins in IE6
- extra image padding in html emails
- decimal places in linux flash player
- broken emails in outlook 2007
- double spaced IE list items
- cannot remove movieclip
articles:
extra items in javascript array
I recently got an email asking why a div, whose content was a list dynamically generated from an javascript array, was suddenly displaying what appeared to be a load of random stuff in addition to the contents of the array. I had come across a similar problem before and therefore offered this response (the overlay method mentioned below is causes the div to be shown and the array to be iterated through at a set interval).
I am guessing that you are calling the overlay method on a page that includes a JavaScript framework of some description, if the framework uses prototyping then it messes up for loops by adding a bunch of additional properties to objects, therefore when you iterate through an array not only do you get the contents of the array (i.e. the strings in this case) you also get the additional properties that the prototyping has given the array object. My guess what you are seeing is the additional properties that the new prototype array has been given, in this case a set of functions. Aren't frameworks great.
One way of working around this, which normally works is to not use for...in loops for iterating through arrays, but switch to for (i=0;i<array.length;i++){.....}