The solution to the problem of syntax error or missing object by introducing JS file IE6

Source: Internet
Author: User

  Introduction of JS file IE6 error or missing object problem presumably a lot of friends have encountered it, the problem is the file coding, the following for you to introduce a better solution

Solve the problem of "Introducing JS file IE6 Error"     problem Description:    page introduces a JS file that defines a function or object, and then calls a function or object in the page, and the IE6 reports "syntax error" or "Missing object." In ie6+ or IE7 it works fine.     Problem Analysis:    This object exists in the JS file being introduced, because browsers above ie6+ can run properly. The problem is file encoding, if the JS file encoding and the current page encoding inconsistent, it may lead to IE6 in the page can not be normal to obtain and parse the contents of JS file, in IE6, the default introduction of the file and page encoding is consistent. In ie6+ above the browser, the general browser will automatically identify the encoding of each external file and resolve;    Problem resolution:    A: The introduction of JS file Add charset properties, and maintain the same page code;  Two: Modify the introduction of file encoding format;  Three: Create a new file format in line with the page encoding format, copy and paste content;  (personal recommendation of the third method, but recommend that when you import JS add charset Properties!)     found problems:    due to reload system, post project found JS error: report grammatical errors and missing objects. Depressed   Before the system is IE7, after reloading the system for IE6. Just started to think that the browser version of the problem, the page to import JS inside there are IE6 incompatible code! So the last JS line of comments out, when the last JS files are all deleted, there are errors above. ------Super Depressed   The previous code is fine, how to reload a system is bad ~ finally find the previous project released, in the IE6 without errors, the code exactly the same. ------------I don't know if I can use the word "depressed"?   Thought for a long time, thinking about coding problems. The previous project was encoded as GB2312, now the item is utf-8  <script language= "JavaScript" type= "Text/javascript" src= "Xx.js" charset= "UTF-8" > </script>  and then did not work, and then to JS the encoding format changed to UTF-8 run also not. Finally a new JS file encoding format changed to Utf-8, release OK.   Halo, General Coding Modification (1). Increase CharSet. (2). Modify the file encoding format. and under Tomcat.The view has also been modified. I don't know what's going on!   may have to delete all in the release bar!!! But the problem is solved ~ if not reload the system, also found that the small bug ----write down to prevent this error occurred!    

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.