Home > Web Front-end > JS Tutorial > Abominable ie8 prompts that the id is missing and is undefined_javascript tips

Abominable ie8 prompts that the id is missing and is undefined_javascript tips

WBOY
Release: 2016-05-16 16:55:02
Original
1075 people have browsed it

Recently I have been programming in javascript, using json, and wrote an array [{'id':'key_01','name':'university'},{'id':'key_02','name':'direct card' },{'id':'key_03','name':'new'},{'id':'key_04','name':'Change'},{'id':'key_05','name ':'M-Zone Card Set'},{'id':'key_06','name':'Inventory'},{'id':'key_07','name':'Fetion'},{'id': 'key_08','name':'Mobile Video'},{'id':'key_09','name':'School Communication'},];

Add to select in a loop on the page , but in IE8, it always prompts that the missing id is undefined, and it is ok in other browsers. Later, I used IE8's js debugging and found that the length of his array is 1 larger than the length of the array in other browsers, but the actual view The array does not have that many values. Later, when I looked carefully, I found that there was an extra comma at the end of the array. Just remove the comma.

It turns out that IE8 has a different method for obtaining the actual value and length. You cannot add extra commas at the end of the array.

Related labels:
ie8
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template