IE6 and IE7 JavaScript json prompts for missing identifier string or number problem handling

  • 2020-05-05 10:57:35
  • OfStack

Yesterday, when I was using Jquery Ui Datapicker to display the sign-in calendar function, Js problem occurred. IE8/IE9 and FF and Chrome were all displayed normally,

However, in the IE6/IE7 and IE8 compatibility views, there is a problem, "there is an error on the page", further view shows the error message "missing identifier, string or number",

At first I thought it was a mismatch between the versions of Jquery and Jquery Ui, but later I tried other supported versions,

Then he adjusted his Js code segment by segment, and after more than two hours found out that the problem was caused by the addition of a comma after the last key value of Json.

Check on the Internet, found a lot of people also encountered this kind of problem. Be careful in the future.


var obj = {
        'name': 'qqyumidi',
        'gender': 'male'  // I can't add here ,  !!!!!
    }
alert(obj.name);

Damn IE6/IE7, when will I say goodbye to hack for IE... Can't help but poke fun at Microsoft


Related articles: