Home  >  Article  >  Web Front-end  >  JavaScript json prompt in IE6/IE7 is missing identifier, string or number problem handling_javascript skills

JavaScript json prompt in IE6/IE7 is missing identifier, string or number problem handling_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:26:18968browse

When I used Jquery Ui Datapicker to display the sign-in calendar function yesterday, a Js problem occurred. It displayed normally under IE8/IE9, FF, and Chrome.

However, there is a problem with the display in IE6/IE7 and IE8 compatible views, prompting "There is an error on the page". Further inspection shows the error message "Missing identifier, string or number",

At first I thought it was caused by the mismatch between Jquery and Jquery Ui versions. Later I tried other supported versions but it didn’t work either.

Then I debugged my Js code piece by piece. After spending more than two hours, I finally discovered that the problem was caused by a comma after the last key value of Json.

I checked online and found that many people also encountered this problem. Be careful in the future.

Copy code The code is as follows:

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

It’s really evil IE6/IE7. When will we say goodbye to the days of doing hacks specifically for IE. . . . . I can’t help but complain about Microsoft

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn