IE7, JavaScript uses [] directory string, failed, why?

Source: Internet
Author: User
IE7, JavaScript uses the [] index string, failed, why?
This post was last edited by CSDNCB on 2015-05-11 09:14:07

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 (); Errors are reported in IE7 or IE7 for kernel browsing
}
}
return res;
}

Know what the rules are, cause?
------to solve the idea----------------------
IE (JScript) adheres to early JavaScript conventions
So the string cannot be manipulated as an array.
Str[i].tostring ()
Should write
Str.charat (i)
------to solve the idea----------------------
Reference:
IE (JScript) adheres to early JavaScript conventions
So the string cannot be manipulated as an array.
Str[i].tostring ()
Should write
Str.charat (i)


Learn the ...
------to solve the idea----------------------
I didn't say it (and I don't know). Look at this, it might help, http://baike.baidu.com/link?url=vKSyRkaROAwAyfcFmmbmx-RyfZ2fG4_. Jv07bormkcu5qrpi26ypdtj8cos8xpx3d63skpbaajkpbpyoz2qr_gk

In view of the differences in JavaScript support for each browser, it is recommended to use the JQuery framework. So you don't have to worry about compatibility.
  • Related Article

    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.