Simple javascript string issue in ie6 and ie7

I have a very simple function that takes a comma separated list of points (x, y) and imports them into a graph. I have FF, Chrome, and IE8 installed. I use IETester to test IE6 and IE7.

// Import Data this.Import = function(data) { alert("Data in: "+data); var d; // Make sure the first and the last are start/ending parenthesis if ( (data[0] != '(') || (data[data.length-1] != ')') ) { alert("After if: "+data[0]+" "+data[data.length-1]); return false; } ... 

In Chrome, FF, and IE8, I don’t see the warning β€œAfter:”. In IE6 and IE7, I see the following two warnings: Data in: (52.16), (100.90) If if: undefined undefined

Warning "Data in" is the same in all browsers.

Any ideas?

+6
javascript string arrays internet-explorer-7 internet-explorer-6
source share
1 answer

Figured it out. You must use .charAt () instead of processing the string as an array in ie6 and 7.

+17
source share

All Articles