Home > Web Front-end > Front-end Q&A > What to do if the javascript pop-up box is garbled

What to do if the javascript pop-up box is garbled

藏色散人
Release: 2021-11-18 11:38:08
Original
2824 people have browsed it

Solution to the garbled javascript pop-up box: 1. Add "charset="utf-8"" to the js introduction code; 2. Add "charset='utf-8'" code to the head. Can.

What to do if the javascript pop-up box is garbled

The operating environment of this article: windows7 system, javascript version 1.8.5, DELL G3 computer

What should I do if the javascript pop-up box is garbled?

Solution to the problem that the javascript pop-up window is garbled:

1. Add charset="utf-8"

<script charset="utf-8" language="javascript" type="text/javascript" src="JS/CommonFields/common.js">
</script>
Copy after login

charset character set to the js introduction code Description, set to utf-8.

2. Add the following code between :

<meta http-equiv="Content-Type" content="text/html; charset=&#39;utf-8&#39;" />
Copy after login

garbled code:

when Chinese When read as unrecognizable characters, it is called garbled characters.

The root cause of garbled characters:

The file has an encoding format when it is saved. It can only be read correctly when the encoding format used when saving is the same as the encoding format used when reading. Files; for example, both UTF-8 encoding and GBK encoding can read Chinese. If UTF-8 encoding is used to save the file, but GBK encoding is used to read the file, it will cause garbled characters. Therefore, files saved in UTF-8 encoding should use UTF- 8 code reading.

The encoding format of the file includes: UTF-8 encoding, GBK encoding, ANSI encoding, GB2312 encoding

Recommended learning: "javascript basic tutorial"

The above is the detailed content of What to do if the javascript pop-up box is garbled. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template