When you use JavaScript to display messages or pass character data, you often encounter a single quotation mark (') or double quotation mark (") in your data, which often results in JavaScript errors. The general use of this/' or/' solution.
For example:
[JavaScript]View Plaincopy
- Alert ("This is test" message"!");
- Alert (' This is test ' message'! ');
It is usually changed to the following statement
[C-sharp]View Plaincopy
- Alert ("This is Test/" message/"!");
- Or
- Alert ("This is test ' message '!");
- Alert (' This is Test/' message/'! ');
If the above is used only in scripts or not too complex data character connections, this problem has been solved.
However, if there is a more complex data character connection, especially some JavaScript statements that are combined by the server, consider using the single quotation mark (') and the double quotation mark (") as the escape sequence (escape sequence) output.
For example, the above statement can be converted into the following format:
[JavaScript]View Plaincopy
- Alert ("This is test/u0022message/u0022!");
- Alert (' This is test/u0027message/u0027! ');
Supplement some of the commonly used codes
Character Description Unicode escape sequence
Long Dash (-)/u2014
Registration symbol (R)/u00ae
Copyright symbol (c)/u00a9
Trademark symbol (?) /u2122
Euro sign (€)/u20ac
Back slash (/)/u005c
Forward slash (/)/u002f
Left Curly brace ({)/u007b
Closing curly braces (})/u007d
Less than sign (<)/u003c
Greater than sign (>)/u003e
asterisk (*)/u002a
& &
' ' (/u0027)
"" (/u0022)
< <
> >
Single and double quotes in JavaScript resolution