A simple aspx file that references a JS File
<Script language = "JavaScript" src = "../JS/jscript1.js"> </SCRIPT>
The JS file statement contains Chinese characters.
Function Test ()
{
VaR mycode;
Mycode = "delete ";
Alert (mycode );
}
When you run the aspx file, the system prompts "uncompleted string constants". The error line is Var mycode. However, if you comment out mycode = "delete", the error will not occur.
Using an HTML file to reference this JS file will not cause errors. Save the HTML generated by aspx and compare it with the tested HTML file. The difference is mainly in the header section. The following is the header code generated by aspx:
<Meta http-equiv = Content-Type content = "text/html; charset = UTF-8">
<Meta content = "mshtml 6.00.00000.2577" name = generator>
<Meta content = C # name = code_language>
<Meta content = JavaScript name = vs_defaultclientscript>
This is part of the code for testing the HTML file header.
<Meta name = "generator" content = "Microsoft Visual Studio. NET 7.1">
<Meta name = "progid" content = "visualstudio. html">
<Meta name = "originator" content = "Microsoft Visual Studio. NET 7.1">
Change the uft-8 in the header of the HTML generated by aspx to gb2312
<Meta http-equiv = Content-Type content = "text/html; charset = gb2312">
Open the modified HTML directly, and the error disappears. However, if gb2312 is specified in Aspx. CS, the page will run garbled characters.
Headache!