When Javascript is used, Chinese characters cannot be properly displayed, because the encoding method is incorrect.
The homepage solves the problem of JS Chinese garbled characters: use NotePad to open the JS file and save it as "UTF-8" to overwrite the previous file. In this way, the preview will not contain garbled characters such as alert and document. Write in JS;
If Javascript is written in an HTML file, add the charset element of Meta to the file header as UTF-8.
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
If Javascript is written in an HTML file, add the charset element of Meta to the file header as UTF-8.
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
Next, if you use vs2005 to open this JS file, all Chinese characters and garbled characters will be displayed. The solution is to select automatic UTF-8 detection in VS 2005 settings.