tags:

views:

51

answers:

2

I have a simple script to retrieve an id from an object list in javascript. Here is the example:

   var element_id;

    if (cur_index !== 0) {
        element_id = _BIG_LIST[cur_index-1];
    }

IE is throwing an error at: _BIG_LIST[cur_index-1]

Error is Object doesn't support this property or method. This works fine in other browsers, and _BIG_LIST is definitely populated. Also cur_index is definitely within the _BIG_LIST object.

Any ideas?

A: 

Are you sure that:

  1. _BIG_LIST is an array?
  2. cur_index is an integer?
Here Be Wolves
var _BIG_LIST = [];and yes cur_index is an integer, would be 0 - 50
Jim H
in that case, debug. Try using the good old `alert()` just before the problem code line.
Here Be Wolves
A: 

This was fixed. The var element_id was not in scope where i was using it, which caused IE to throw the error.

Jim H