In IE7, why does Javascript fail to use index strings? -Php Tutorial

Source: Internet
Author: User
In IE7, why does Javascript fail to use index strings? The problem code is described as follows:
Function filter_str (str ){
Var res = "";
For (var I = 0; I
Var c = str. charCodeAt (I );
If (c> 32 & c! = 127 & c! = 39 ){
Res + = str [I]. toString (); // when IE7 or IE7 is the kernel, an error is reported.
}
}
Return res;
}

Do you know what the rule is?


Reply to discussion (solution)

IE (JScript) complies with earlier JavaScript conventions
Therefore, strings cannot be operated in array mode.
Str [I]. toString ()
Ying writing
Str. charAt (I)

IE (JScript) complies with earlier JavaScript conventions
Therefore, strings cannot be operated in array mode.
Str [I]. toString ()
Ying writing
Str. charAt (I)



Learning...

What is the difference between the early JavaScript conventions and the current JavaScript conventions? Where can I find out? are there any relevant documents?


Thank you.

I'm not sure about this (or I am not clear) to see this may help http://baike.baidu.com/link? Url = vKSyRkaROAwAyfcFmmbmx-RyfZ2fG4_jv07bOrmkCu5QRPI26ypDTj8COS8Xpx3D63sKpBaaJkpbPyOZ2Qr_gK

We recommend that you use the JQuery framework in view of the differences in js support of different browsers. In this way, it is not necessary to worry about compatibility.

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.