Home >Web Front-end >JS Tutorial >Solution to JavaScript unterminated string constant error under IE6_javascript tips
It is mentioned that "DOM is UTF-8 encoding. If the JS library is not a separate independent JS file, but is included in the DOM, this problem will not occur. However, the separated JS file is not UTF-8 encoded , is added to the UTF-8 encoded DOM, Chinese characters will appear garbled, and the quotation marks will be affected, making the browser unable to determine the end of the string. The solution is very simple, just save the JS file in UTF-8 encoding format. . ”
So I modified the JavaScript reference,
After the modification, It can run normally and correctly. It seems that it is really a problem with the Chinese encoding format.
Problem: Although using gb2312 can solve the problem. But UTF-8 cannot. Further research is needed.
The project did not perform satisfactorily under IE6, which made me sweat. If someone hadn't used IE7, I wouldn't have been able to get angry even if I was extremely angry. The deception has passed, but the problem still needs to be solved. You must know that IE6 is still the main browser. After coming back, I used IE6 on the remote server to carefully check the erroneous JS library, and the prompt was "unterminated string constant". I wonder if I forgot to add a quote. Even if I forget to add a quote to end the string, the same error will occur under IE7 and FireFox. Why is it so good? After finding the line with the error, the truth came out...
I need an event to handle the user's click on the button and set the project warning information to "read" so that the warning information box will no longer pop up. Jquery will call the processing script and return processing information. If the processing information is true, it means the setting is successful. The JS code will specify the information element in the DOM to modify the HTML, that is, set "unread" to "read".