An escape string (escape sequence) is also called a character entity (character ).
Entity ). In HTML, there are two reasons for defining escape strings: The first reason is that symbols such as "<" and ">" are already used to represent HTML tags, so they cannot directly
When connectedCompositionThe symbols in this example. To use these symbols in HTML documents, you need to define its escape string. When interpretingProgramWhen such a string is encountered, it is interpreted as a real character. When you enter an escape string, you must strictly follow the uppercase/lowercase rules. The second reason is that some characters are not defined in the ASCII character set, so escape strings must be used for representation. The most common character entity in the HTML special Escape Character List
Character entities
Display |
Description |
Entity name |
Entity ID |
|
Blank |
& ENSP; |
& #8194; |
|
Wide white space |
& Amp; emsp; |
& #8195; |
|
Blank rows |
& Nbsp; |
& #160; |
< |
Less |
& Lt; |
& #60; |
> |
Greater |
& Gt; |
& #62; |
& |
& Symbol |
& Amp; |
& #38; |
" |
Double quotation marks |
& Quot; |
& Amp; #34; |
|
Copyright |
& Copy; |
& #169; |
|
Registered Trademark |
& Reg; |
& #174; |
|
Trademark (USA) |
|
& #8482; |
× |
Multiplication number |
& Times; |
& #215; |
Bytes |
Division Number |
& Divide; |
& #247; |
Other characters
Character |
Decimal |
Escape characters |
Character |
Decimal |
Escape characters |
Character |
Decimal |
Escape characters |
? |
& #161; |
& Iexcl; |
Á |
& #193; |
& Aacute; |
Á |
& #225; |
& Aacute; |
Bytes |
& #162; |
& Cent; |
 |
& #194; |
& Amp; CIRC; |
 |
& #226 |
& Acirc; |
Bytes |
& #163; |
& Pound; |
Bytes |
& #195; |
& Atilde; |
Bytes |
& #227; |
& Atilde; |
Bytes |
& #164; |
& Curren; |
Ä |
& #196; |
& Auml |
Ä |
& #228; |
& Auml; |
¥ |
& #165; |
& Yen; |
Bytes |
& #197; |
& Ring; |
Bytes |
& #229; |
& Aring; |
| |
& #166; |
& Brvbar; |
Bytes |
& #198; |
& Aelig; |
Bytes |
& #230; |
& Aelig; |
§ |
& #167; |
& Sect; |
C. |
& #199; |
& Ccedil; |
C. |
& #231; |
& Ccedil; |
○ |
& #168; |
& UML; |
? |
& #200; |
& Egrave; |
? |
& #232; |
& Egrave; |
|
& #169; |
& Copy; |
É |
& #201; |
& Eacute; |
É |
& #233; |
& Eacute; |
A |
& #170; |
& Ordf; |
Bytes |
& #202; |
& Ecirc; |
Bytes |
& #234; |
& Ecirc; |
? |
& #171; |
& Laquo; |
Bytes |
& #203; |
& Euml; |
Bytes |
& #235; |
& Euml; |
? |
& #172; |
& Not; |
Bytes |
& #204; |
& Igrave; |
Bytes |
& #236; |
& Igrave; |
\ X7f |
& #173; |
& Shy; |
Í |
& #205; |
& Iacute; |
Í |
& #237; |
& Iacute; |
|
& #174; |
& Reg; |
Bytes |
& #206; |
& Icirc; |
Bytes |
& #238; |
& Icirc; |
Bytes |
& #175; |
& Macr; |
Bytes |
& #207; |
& Iuml; |
Bytes |
& #239; |
& Iuml; |
° |
& #176; |
& Deg; |
Bytes |
& #208; |
& ETH; |
Bytes |
& #240; |
& Ieth; |
± |
& #177; |
& Plusmn; |
N |
& #209; |
& Ntilde; |
N |
& #241; |
& Ntilde; |
2 |
& #178; |
& Sup2; |
Bytes |
& #210; |
& Ograve; |
Bytes |
& #242; |
& Ograve; |
3 |
& #179; |
& Sup3; |
Ó |
& #211; |
& Oacute; |
Ó |
& #243; |
& Oacute; |
′ |
& #180; |
& Acute; |
Bytes |
& #212; |
& Ocirc; |
Bytes |
& #244; |
& Ocirc; |
μ |
& #181; |
& Micro; |
Bytes |
& #213; |
& Otilde; |
Bytes |
& #245; |
& Otilde; |
? |
& #182; |
& Para; |
Ö |
& #214; |
& Ouml; |
Ö |
& #246; |
& Ouml; |
· |
& #183; |
& Middot; |
& Times; |
& #215; |
& Times; |
Bytes |
& #247; |
& Divide; |
? |
& #184; |
& Cedil; |
Ø |
& #216; |
& Oslash; |
Ø |
& #248; |
& Oslash; |
1 |
& #185; |
& Sup1; |
Bytes |
& #217; |
& Ugrave; |
Bytes |
& #249; |
& Ugrave; |
O |
& #186; |
& ORDM; |
Úo |
& #218; |
& Uacute; |
Úo |
& #250; |
& Uacute; |
? |
& #187; |
& Raquo; |
Bytes |
& #219; |
& Ucirc; |
Bytes |
& #251; |
& Ucirc; |
? |
& #188; |
& Frac14; |
Ü |
& #220; |
& Uuml; |
Ü |
& #252; |
& Uuml; |
? |
& #189; |
& Frac12; |
Bytes |
& #221; |
& Yacute; |
Bytes |
& #253; |
& Yacute; |
? |
& #190; |
& Frac34; |
Bytes |
& #222; |
& Thorn; |
Bytes |
& #254; |
& Thorn; |
? |
& #191; |
& Iquest; |
Bytes |
& #223; |
& Szlig; |
Bytes |
& #255; |
& Yuml; |
À |
& #192; |
& Agrave; |
À |
& #224; |
& Agrave; |
|
--------------------------------------
Javascript escape characters
Escape characters |
Description |
\ B |
Return |
\ T |
Tab, horizontal |
\ V |
Tab, vertical |
\ N |
Carriage return line feed |
\ R |
Line feed |
\" |
Double quotation marks |
\' |
Single digit |
\\ |
\ |
\ Uhhhh |
Hexadecimal Unicode characters |
--------------------------------------
<HTML>
<Body>
<Input value = "Double quotation marks in double quotation marks-error" type = "button" onclick = "alert (" OK ");"/> <br/>
<Input value = "single quotes in single quotes-error" type = "button" onclick = 'alert ('OK'); '/> <br/>
<Input value = "Two double quotes-error" type = "button" onclick = "alert (" OK ""); "/> <br/>
<Input value = "two single quotes-error" type = "button" onclick = "alert ('' OK '');"/> <br/>
<Input value = "\ + double quotation marks-error" type = "button" onclick = "alert (\" OK \ ");"/> <br/>
<Input value = "\ + single quotes-error" type = "button" onclick = "alert (\ 'OK \');"/> <br/>
<Input value = "Double quotation marks-OK" type = "button" onclick = "alert ('OK');"/> <br/>
<Input value = "Double quotation marks in single quotes-OK" type = "button" onclick = 'alert ("OK"); '/> <br/>
<Input value = "external quotation marks-OK" type = "button" onclick = alert ('OK'); alert ("OK");/> <br/>
</Body>
</Html>
// The parameter in the event binding function alert. If it is a number, it can be directly written. If it is a string, it must be enclosed in single quotation marks. Other functions also do the same.
// Project comparison:
1. Pass the parameter as a string
Searchresultcontent = searchresultcontent + "<tr> <TD align = 'center'>" + I + "</TD> <TD align = 'center'>" + graphic. attributes ["name"] + "</TD> <TD align = 'center'> area </TD> <TD align = 'center'> type </TD> <TD align = 'center'> production time </TD> "+" <TD align = 'center' "+"Onclick = generatedetails ('" + graphic. attributes ["name"] + "');"+ "> Details </TD> </tr> ";
2. Pass the parameter as a number
Searchresultcontent = searchresultcontent + "<a" +"Onclick = lightengraphic (" + index + "," + Position + ");"+ "Href = \" javascript: void (0) \ ";>" + graphic. attributes ["zonename"] + "</a>" + "";
3,
// Parameters are passed in the event binding function. If the parameter is a number, no single quotation marks are required. If the parameter is a string, single quotation marks are required;
// You do not need to add semicolons between the events associated with the parallel binding; otherwise, the subsequent events cannot be bound.
Searchresultcontent = searchresultcontent + "<a" +
"Onmouseout = unlightengraphic (" + index + ")" +
"Onclick = lightengraphic (" + index + "," + Position + ");" +
"Href = \" javascript: void (0) \ "; style = \" cursor: pointer \ ";>" +
Graphic. attributes ["zonename"] +
"" + "";