Damn IE8. Hint missing ID not defined

Source: Internet
Author: User
Tags array length

Loops are added to the select in the page, but the missing ID is not defined in the IE8, and the last comma of the array is tested and the comma is removed.

Have been programming with JavaScript recently, using JSON, I wrote the array [{' id ': ' key_01 ', ' name ': ' The University '},{' ID ': ' key_02 ', ' name ': ' Direct send card '},{' id ': ' key_03 ', ' name ' : ' Freshman '},{' id ': ' key_04 ', ' name ': '},{' id ': ' key_05 ', ' name ': ' Dynamic zone sleeve card '},{' id ': ' key_06 ', ' name ': ' Inventory '},{' id ': ' key_07 ', ' Name ': '},{' id ': ' key_08 ', ' name ': ' Mobile video '},{' id ': ' key_09 ', ' name ': ' School Communication '};

Loops are added to the select in the page, but in the IE8 has always been prompted missing ID undefined, in other browsers are OK, and later use IE8 JS debugging, found that his array length than in other browsers in the length of the array 1, while the actual view of the array does not have so many values, and then look carefully, Only to find the last comma of the array, the comma removed the good.

The original IE8 get the actual value and length of the time the method is not the same, can not at the end of the array add extra commas.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.