IE throws JavaScript Error: The value of the property 'googleMapsQuery' is null or undefined, not a Function object (works in other browsers)

前端 未结 6 1519
余生分开走
余生分开走 2021-01-17 15:00

I\'m having a real problem with JavaScript scope in IE 9.

This is inside the body of my document (yes, I realize script should go in the head for proper HTML, but I\

6条回答
  •  -上瘾入骨i
    2021-01-17 15:23

    I found the answer, and in spite of what I reported, it was NOT browser specific. The bug was in my function code, and would have occurred in any browser. It boils down to this. I had two lines in my code that were FireFox/FireBug specific. They used console.log. In IE, they threw an error, so I commented them out (or so I thought). I did a crappy job commenting them out, and broke the bracketing in my function.

    Original Code (with console.log in it):

    if (sxti.length <= 50) console.log('sxti=' + sxti);
    if (sxph.length <= 50) console.log('sxph=' + sxph);
    

    Broken Code (misplaced brackets inside comments):

    if (sxti.length <= 50) { //console.log('sxti=' + sxti); }
    if (sxph.length <= 50) { //console.log('sxph=' + sxph); }
    

    Fixed Code (fixed brackets outside comments):

    if (sxti.length <= 50) { }//console.log('sxti=' + sxti);
    if (sxph.length <= 50) { }//console.log('sxph=' + sxph);
    

    So, it was my own sloppy coding. The function really wasn't defined, because a syntax error kept it from being closed.

    Oh well, live and learn. ;)

提交回复
热议问题