0

I have a script which parses an xml document.

IE gives an error on this line.

alarmlog[j][0] = EALog[j].getElementsByTagName("LDsp")[0].childNodes[0].nodeValue;

I checked to make sure that the value is available. I can alert this value, and it looks good. But IE keeps showing the error

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.3; chromeframe/28.0.1500.95; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; .NET CLR 3.0.04506.648; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Mon, 19 Aug 2013 20:44:12 UTC


Message: Object required
Line: 503
Char: 4
Code: 0
URI: http://192.168.254.105/sensorLog.html

Hoping to get some hints. Thanks

aVC
  • 2,254
  • 2
  • 24
  • 46
  • Can you alert `alarmlog[j][0]`? Assuming everything on the right side of the assignment operator is working an `undefined` value on `alarmlog[j]` could produce this error. – Josiah Ruddell Aug 19 '13 at 20:54
  • @JosiahRuddell Yes, I can alert alarmlog[j][0] and it shows the correct value. – aVC Aug 19 '13 at 20:56
  • 1
    My next guess would be data related. Possibly invalid characters or white-space. You would need to provide more information like an xml snippet and more of the code. Have a look at [common IE javascript mistakes](http://stackoverflow.com/questions/359895/what-are-the-most-likely-causes-of-javascript-errors-in-ie8) also. – Josiah Ruddell Aug 19 '13 at 21:00
  • @JosiahRuddell Yup you are right. I had more than one similar lines of code parsing the xml, and turns out one of them was blank, causing IE to break. Great advice. Not sure if you care about an accepted answers, but more than glad to accept it, if you can post your comment as the answer :) thanks very much. – aVC Aug 19 '13 at 21:20
  • Sure! glad that helped out. I posed the comments as an answer. – Josiah Ruddell Aug 19 '13 at 21:50

1 Answers1

0

Can you alert alarmlog[j][0]? Assuming everything on the right side of the assignment operator is working an undefined value on alarmlog[j] could produce this error.

UPDATE:

My next guess would be data related. Possibly invalid characters or white-space. You would need to provide more information like an xml snippet and more of the code. Have a look at common IE javascript mistakes also.

Community
  • 1
  • 1
Josiah Ruddell
  • 29,697
  • 8
  • 65
  • 67