Current location - Training Enrollment Network - Mathematics courses - How to output HTML tags on a page
How to output HTML tags on a page
How to display a script or html tag 10 on a page?

Such as the title:

For example:

& lt& gt/ These symbols are to be escaped, that is, replaced by some special characters.

HTML character entity, escape sequence.

Why use escape strings?

This is about HTML escape sequences.

Escape sequences are also called character entities. In HTML, escape strings are defined for two reasons: The first reason is that symbols like ""have been used to represent HTML tags, so they cannot be directly used as symbols in text. In order to use these symbols in HTML documents, you need to define its escape string. When the interpreter encounters such a string, it will interpret it as a real character. When you enter an escape string, you should strictly abide by the case rules of letters. The second reason is that some characters are not defined in the ASCII character set, so they need to be represented by escape strings.

Composition of escape string

Escape sequence, that is, character entity, is divided into three parts: the first part is a &;; Symbol, called & symbol; In English; The second part is the entity name or # plus the entity number; The third part is a semicolon.

For example, to display images smaller than (

The advantage of using entity names is that they are easy to understand. If you look at lt, you can probably guess that it means less than, but its disadvantage is that all browsers support the latest entity names. Entity numbers can be handled by various browsers.

Tip: Entity names are case-sensitive.

Note: The same symbol can be referenced in two ways: entity name and entity number. The advantage of the entity name is that it is easy to remember, but it can't guarantee that all browsers can recognize it smoothly, and the entity number has no such worry, but it is really inconvenient to remember.

How to display spaces?

Usually, HTML will automatically delete extra spaces. No matter how many spaces are added, it counts as a space. For example, if you add 10 spaces between two words, HTML will cut off 9 spaces and keep only one. To add spaces to a web page, you can use to represent spaces.

HTML special escape character list

The most commonly used character entities

Character entity

show

explain

Entity name

Entity number

A blank half square? ?

A big blank in all directions? ?

A constant blank?

Less than & lt

& gt is greater than >>

& amp& amp art.

"Double quotation marks" "

Copyright? ?

Registered trademark? ?

Trademark (USA)? ?

× multiplication sign? ?

Divider? ?

10859-1 (Latin-1) character set.

HTML 4.0 1 supports the ISO 8859- 1 (Latin-1) character set.

Note: For convenience, in the table below, "Entity Name" is abbreviated as "Name" and "Entity Number" is abbreviated as "Number".

show

name

figure

show

name

figure

show

name

figure

show

name

figure

show

name

figure

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

× ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? à ? ?

á ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? è ? ? é ? ? ê ? ?

? ? ì ? ? í ? ? ? ? ? ? ? ?

? ? ? ? ? ò ? ? ó ? ? ? ? ?

? ? ? ? ? ÷ ? ? ? ? ? ù ? ?

ú ? ? ? ? ? ü ? ? ? ? ? ? ? ?

Zazie Hoko

Mathematics and Greek alphabet symbols

Symbols, mathematical symbols and Greek letters

show

name

figure

show

name

figure

show

name

figure

show

name

figure

show

name

figure

? ? Α ? ? Β ? ? Γ ? ? Δ ? ?

Ε ? ? Ζ ? ? Η ? ? Θ ? ? Ι ? ?

Κ ? ? Λ ? ? Μ ? ? Ν ? ? Ξ ? ?

Ο ? ? Π ? ? Ρ ? ? Σ ? ? Τ ? ?

Υ ? ? Φ ? ? Χ ? ? Ψ ? ? Ω ? ?

α ? ? β ? ? γ ? ? δ ? ? ε ? ?

ζ ? ? η ? ? θ ? ? ι ? ? κ ? ?

λ ? ? μ ? ? ν ? ? ξ ? ? ο ? ?

π ? ? ρ ? ? ? ? ? σ ? ? τ ? ?

υ ? ? φ ? ? χ ? ? ψ ? ? ω ? ?

? ? ? ? ? ? ? ? ? ? ? … ? ?

′ ? ? ″ ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ← ? ?

↑ ? ? → ? ? ↓ ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

∈ ? ? ? ? ? ? ? ? ∏ ? ? ∑ ? ?

? ? ? ? ? √ ? ? ∝ ? ? ∞ ? ?

∠ ? ? ∧ ? ? ∨ ? ? ∩ ? ? ∪ ? ?

∫ ? ? ∴ ? ? ? ? ? ∝ ? ? ≈ ? ?

≠ ? ? ≡ ? ? ≤ ? ? ≥ ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ⊕ ? ?

? ? ⊥ ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ?

Important international symbols

Mark important characters and internationalized characters

show

name

figure

show

name

figure

show

name

figure

show

name

figure

show

name

figure

" " " & amp& amp& amp& lt& lt& lt& gt& gt& gt? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? – ? ? — ? ?

? ? '? ? ? ? ? " ? ? " ? ?

? ? ? ? ? ? ? ? ‰ ? ? ? ? ?

? ? ? ? ?

JavaScript escape character

Escape sequence

Character; Role; letter

\b backspace key

\f Press paper to change pages.

\n newline character

\r input.

\ t horizontal tab (Ctrl-I)

Single quotation mark'

"double quotation marks

\ \ backslash

Pay attention to the problem of special characters when programming. Many runtime problems are caused by the appearance of special characters.

Note that because the backslash itself is used as an escape character, you cannot type the backslash directly in the script. To generate a backslash, you must type two backslashes (\ \) at the same time.

Encoding conversion (to Unicode)

(The program code comes from the network)

Js edition

& lt script & gt

Test = "Hello abc"

str = " "

for(I = 0; I < test the length; i++)

{

temp = test.charCodeAt(i)。 toString( 16);

Str += "\\u"+ new array (5 strings (temp)). Length). join(" 0 ")+temp;

}

Document. writing (string)

& lt/script & gt;

Vbs version

Function Unicode(str 1)

Dim string, temperature

str = " "

For i= 1 to len(str 1)

temp = Hex(AscW(Mid(str 1,I, 1)))

if len(temp)& lt; 5 Then temp = right(" 0000 "& amp; Temperature, 4)

str = str & amp“\ u”& amp; temp

then

Unicode = str

End function

Function htmlentities(str)

For i = 1 to Len(str)

char = mid(str,I, 1)

If Ascw(char) > then 128

Html entities = html entities & amp "& ascw (char) and amp"; "

other

Html entities = html entities & tea

If ... it will be over.

then

End function

Coldfusion version

Function nochaoscode(str)

{

var new _ str =

for(I = 1; I LTE len(str); i=i+ 1){

if(asc(mid(str,I, 1)) lt 128){

new _ str = new _ str & ampmid(str,I, 1);

} Otherwise {

new _ str = new _ str & amp" # " & ampasc(mid(str,I, 1));

}

}

Returns new _ str

}

Attached:

In php, we can use mb_convert_encoding function of mbstring to realize this forward and backward conversion. For example:

Mb_convert_encoding ("Hello "," HTML-ENTITIES "," GB 23 12 "); //Output:

mb_convert_encoding("、" gb23 12 "、" HTML-ENTITIES "); //output: Hello.

If you need to convert the whole page, just add these three lines of code at the beginning of the php file:

MB _ internal _ encoding(" GB 23 12 "); //gb23 12 here is the original code of your website.

MB _ http _ output(" HTML-ENTITIES ");

ob _ start(' MB _ output _ handler ');