Разработка сайтов, создание сайтов
главная / JavaScript / Таблица сущностей HTML 4.0

Таблица сущностей HTML 4.0

При написании очередного мегапроекта встала непосильная задача - сделать красивости средствами яваскрипта. Суть проблемы заключалась в том, чтобы использовать всякие вкусности типа  , – и т.д. средствами JavaScript при заполнении динамических списков SELECT. Требовалось заменить короткий знак - (минус) на более длинный и красивый – (–).

Порывшись в сети, нашёл, что можно использовать функцию String.fromCharCode() для получения UNICODE-символа по его коду. Список символов (сущностей) HTML нашёлся по адресу http://www.w3.org/TR/html4/sgml/entities.htm , правда, в несколько непотребном виде. Однако, мою проблему со списками удалось решить:

...
// Создание элемента Option с заменой в названии минуса на –
var opt = new Option(name.replace(/-/g, String.fromCharCode(0x2013)));
...

После некоторых махинаций со списком от W3C получилась такая табличка:

Символ Сущность Сущность-код Использование в JavaScript
Пробелы

    String.fromCharCode(0x00A0)
    String.fromCharCode(0x2002)
    String.fromCharCode(0x2003)
Спецсимволы (HTML)
" " " String.fromCharCode(0x0022)
& & & String.fromCharCode(0x0026)
< &lt; &#60; String.fromCharCode(0x003C)
> &gt; &#62; String.fromCharCode(0x003E)
Π&OElig; &#338; String.fromCharCode(0x0152)
œ &oelig; &#339; String.fromCharCode(0x0153)
Š &Scaron; &#352; String.fromCharCode(0x0160)
š &scaron; &#353; String.fromCharCode(0x0161)
Ÿ &Yuml; &#376; String.fromCharCode(0x0178)
ˆ &circ; &#710; String.fromCharCode(0x02C6)
˜ &tilde; &#732; String.fromCharCode(0x02DC)
&thinsp; &#8201; String.fromCharCode(0x2009)
&zwnj; &#8204; String.fromCharCode(0x200C)
&zwj; &#8205; String.fromCharCode(0x200D)
&lrm; &#8206; String.fromCharCode(0x200E)
&rlm; &#8207; String.fromCharCode(0x200F)
&ndash; &#8211; String.fromCharCode(0x2013)
&mdash; &#8212; String.fromCharCode(0x2014)
&lsquo; &#8216; String.fromCharCode(0x2018)
&rsquo; &#8217; String.fromCharCode(0x2019)
&sbquo; &#8218; String.fromCharCode(0x201A)
&ldquo; &#8220; String.fromCharCode(0x201C)
&rdquo; &#8221; String.fromCharCode(0x201D)
&bdquo; &#8222; String.fromCharCode(0x201E)
&dagger; &#8224; String.fromCharCode(0x2020)
&Dagger; &#8225; String.fromCharCode(0x2021)
&permil; &#8240; String.fromCharCode(0x2030)
&lsaquo; &#8249; String.fromCharCode(0x2039)
&rsaquo; &#8250; String.fromCharCode(0x203A)
&euro; &#8364; String.fromCharCode(0x20AC)
¡ &iexcl; &#161; String.fromCharCode(0x00A1)
¢ &cent; &#162; String.fromCharCode(0x00A2)
£ &pound; &#163; String.fromCharCode(0x00A3)
¤ &curren; &#164; String.fromCharCode(0x00A4)
¥ &yen; &#165; String.fromCharCode(0x00A5)
¦ &brvbar; &#166; String.fromCharCode(0x00A6)
§ &sect; &#167; String.fromCharCode(0x00A7)
¨ &uml; &#168; String.fromCharCode(0x00A8)
© &copy; &#169; String.fromCharCode(0x00A9)
ª &ordf; &#170; String.fromCharCode(0x00AA)
« &laquo; &#171; String.fromCharCode(0x00AB)
» &raquo; &#187; String.fromCharCode(0x00BB)
¬ &not; &#172; String.fromCharCode(0x00AC)
­ &shy; &#173; String.fromCharCode(0x00AD)
® &reg; &#174; String.fromCharCode(0x00AE)
¯ &macr; &#175; String.fromCharCode(0x00AF)
° &deg; &#176; String.fromCharCode(0x00B0)
± &plusmn; &#177; String.fromCharCode(0x00B1)
² &sup2; &#178; String.fromCharCode(0x00B2)
³ &sup3; &#179; String.fromCharCode(0x00B3)
´ &acute; &#180; String.fromCharCode(0x00B4)
µ &micro; &#181; String.fromCharCode(0x00B5)
&para; &#182; String.fromCharCode(0x00B6)
· &middot; &#183; String.fromCharCode(0x00B7)
¸ &cedil; &#184; String.fromCharCode(0x00B8)
¹ &sup1; &#185; String.fromCharCode(0x00B9)
º &ordm; &#186; String.fromCharCode(0x00BA)
¼ &frac14; &#188; String.fromCharCode(0x00BC)
½ &frac12; &#189; String.fromCharCode(0x00BD)
¾ &frac34; &#190; String.fromCharCode(0x00BE)
¿ &iquest; &#191; String.fromCharCode(0x00BF)
Стрелочки, указатели, посылатели
&larr; &#8592; String.fromCharCode(0x2190)
&uarr; &#8593; String.fromCharCode(0x2191)
&rarr; &#8594; String.fromCharCode(0x2192)
&darr; &#8595; String.fromCharCode(0x2193)
&harr; &#8596; String.fromCharCode(0x2194)
&crarr; &#8629; String.fromCharCode(0x21B5)
&lArr; &#8656; String.fromCharCode(0x21D0)
&uArr; &#8657; String.fromCharCode(0x21D1)
&rArr; &#8658; String.fromCharCode(0x21D2)
&dArr; &#8659; String.fromCharCode(0x21D3)
&hArr; &#8660; String.fromCharCode(0x21D4)
Пунктуация
&bull; &#8226; String.fromCharCode(0x2022)
&hellip; &#8230; String.fromCharCode(0x2026)
&prime; &#8242; String.fromCharCode(0x2032)
&Prime; &#8243; String.fromCharCode(0x2033)
&oline; &#8254; String.fromCharCode(0x203E)
&frasl; &#8260; String.fromCharCode(0x2044)
Похожие на буквы красявости
&weierp; &#8472; String.fromCharCode(0x2118)
&image; &#8465; String.fromCharCode(0x2111)
&real; &#8476; String.fromCharCode(0x211C)
&trade; &#8482; String.fromCharCode(0x2122)
&alefsym; &#8501; String.fromCharCode(0x2135)
Греческий алфавит
Α &Alpha; &#913; String.fromCharCode(0x0391)
Β &Beta; &#914; String.fromCharCode(0x0392)
Γ &Gamma; &#915; String.fromCharCode(0x0393)
Δ &Delta; &#916; String.fromCharCode(0x0394)
Ε &Epsilon; &#917; String.fromCharCode(0x0395)
Ζ &Zeta; &#918; String.fromCharCode(0x0396)
Η &Eta; &#919; String.fromCharCode(0x0397)
Θ &Theta; &#920; String.fromCharCode(0x0398)
Ι &Iota; &#921; String.fromCharCode(0x0399)
Κ &Kappa; &#922; String.fromCharCode(0x039A)
Λ &Lambda; &#923; String.fromCharCode(0x039B)
Μ &Mu; &#924; String.fromCharCode(0x039C)
Ν &Nu; &#925; String.fromCharCode(0x039D)
Ξ &Xi; &#926; String.fromCharCode(0x039E)
Ο &Omicron; &#927; String.fromCharCode(0x039F)
Π &Pi; &#928; String.fromCharCode(0x03A0)
Ρ &Rho; &#929; String.fromCharCode(0x03A1)
Σ &Sigma; &#931; String.fromCharCode(0x03A3)
Τ &Tau; &#932; String.fromCharCode(0x03A4)
Υ &Upsilon; &#933; String.fromCharCode(0x03A5)
Φ &Phi; &#934; String.fromCharCode(0x03A6)
Χ &Chi; &#935; String.fromCharCode(0x03A7)
Ψ &Psi; &#936; String.fromCharCode(0x03A8)
Ω &Omega; &#937; String.fromCharCode(0x03A9)
α &alpha; &#945; String.fromCharCode(0x03B1)
β &beta; &#946; String.fromCharCode(0x03B2)
γ &gamma; &#947; String.fromCharCode(0x03B3)
δ &delta; &#948; String.fromCharCode(0x03B4)
ε &epsilon; &#949; String.fromCharCode(0x03B5)
ζ &zeta; &#950; String.fromCharCode(0x03B6)
η &eta; &#951; String.fromCharCode(0x03B7)
θ &theta; &#952; String.fromCharCode(0x03B8)
ι &iota; &#953; String.fromCharCode(0x03B9)
κ &kappa; &#954; String.fromCharCode(0x03BA)
λ &lambda; &#955; String.fromCharCode(0x03BB)
μ &mu; &#956; String.fromCharCode(0x03BC)
ν &nu; &#957; String.fromCharCode(0x03BD)
ξ &xi; &#958; String.fromCharCode(0x03BE)
ο &omicron; &#959; String.fromCharCode(0x03BF)
π &pi; &#960; String.fromCharCode(0x03C0)
ρ &rho; &#961; String.fromCharCode(0x03C1)
ς &sigmaf; &#962; String.fromCharCode(0x03C2)
σ &sigma; &#963; String.fromCharCode(0x03C3)
τ &tau; &#964; String.fromCharCode(0x03C4)
υ &upsilon; &#965; String.fromCharCode(0x03C5)
φ &phi; &#966; String.fromCharCode(0x03C6)
χ &chi; &#967; String.fromCharCode(0x03C7)
ψ &psi; &#968; String.fromCharCode(0x03C8)
ω &omega; &#969; String.fromCharCode(0x03C9)
ϑ &thetasym; &#977; String.fromCharCode(0x03D1)
ϒ &upsih; &#978; String.fromCharCode(0x03D2)
ϖ &piv; &#982; String.fromCharCode(0x03D6)
Физика, математика
&forall; &#8704; String.fromCharCode(0x2200)
&part; &#8706; String.fromCharCode(0x2202)
&exist; &#8707; String.fromCharCode(0x2203)
&empty; &#8709; String.fromCharCode(0x2205)
&nabla; &#8711; String.fromCharCode(0x2207)
&isin; &#8712; String.fromCharCode(0x2208)
&notin; &#8713; String.fromCharCode(0x2209)
&ni; &#8715; String.fromCharCode(0x220B)
&prod; &#8719; String.fromCharCode(0x220F)
&sum; &#8721; String.fromCharCode(0x2211)
&minus; &#8722; String.fromCharCode(0x2212)
&lowast; &#8727; String.fromCharCode(0x2217)
&radic; &#8730; String.fromCharCode(0x221A)
&prop; &#8733; String.fromCharCode(0x221D)
&infin; &#8734; String.fromCharCode(0x221E)
&ang; &#8736; String.fromCharCode(0x2220)
&and; &#8743; String.fromCharCode(0x2227)
&or; &#8744; String.fromCharCode(0x2228)
&cap; &#8745; String.fromCharCode(0x2229)
&cup; &#8746; String.fromCharCode(0x222A)
&int; &#8747; String.fromCharCode(0x222B)
&there4; &#8756; String.fromCharCode(0x2234)
&sim; &#8764; String.fromCharCode(0x223C)
&cong; &#8773; String.fromCharCode(0x2245)
&asymp; &#8776; String.fromCharCode(0x2248)
&ne; &#8800; String.fromCharCode(0x2260)
&equiv; &#8801; String.fromCharCode(0x2261)
&le; &#8804; String.fromCharCode(0x2264)
&ge; &#8805; String.fromCharCode(0x2265)
&sub; &#8834; String.fromCharCode(0x2282)
&sup; &#8835; String.fromCharCode(0x2283)
&nsub; &#8836; String.fromCharCode(0x2284)
&sube; &#8838; String.fromCharCode(0x2286)
&supe; &#8839; String.fromCharCode(0x2287)
&oplus; &#8853; String.fromCharCode(0x2295)
&otimes; &#8855; String.fromCharCode(0x2297)
&perp; &#8869; String.fromCharCode(0x22A5)
&sdot; &#8901; String.fromCharCode(0x22C5)
&lceil; &#8968; String.fromCharCode(0x2308)
&rceil; &#8969; String.fromCharCode(0x2309)
&lfloor; &#8970; String.fromCharCode(0x230A)
&rfloor; &#8971; String.fromCharCode(0x230B)
&lang; &#9001; String.fromCharCode(0x2329)
&rang; &#9002; String.fromCharCode(0x232A)
Геометрические фигуры
&loz; &#9674; String.fromCharCode(0x25CA)
&spades; &#9824; String.fromCharCode(0x2660)
&clubs; &#9827; String.fromCharCode(0x2663)
&hearts; &#9829; String.fromCharCode(0x2665)
&diams; &#9830; String.fromCharCode(0x2666)
Кракозябры
À &Agrave; &#192; String.fromCharCode(0x00C0)
Á &Aacute; &#193; String.fromCharCode(0x00C1)
 &Acirc; &#194; String.fromCharCode(0x00C2)
à &Atilde; &#195; String.fromCharCode(0x00C3)
Ä &Auml; &#196; String.fromCharCode(0x00C4)
Å &Aring; &#197; String.fromCharCode(0x00C5)
Æ &AElig; &#198; String.fromCharCode(0x00C6)
Ç &Ccedil; &#199; String.fromCharCode(0x00C7)
È &Egrave; &#200; String.fromCharCode(0x00C8)
É &Eacute; &#201; String.fromCharCode(0x00C9)
Ê &Ecirc; &#202; String.fromCharCode(0x00CA)
Ë &Euml; &#203; String.fromCharCode(0x00CB)
Ì &Igrave; &#204; String.fromCharCode(0x00CC)
Í &Iacute; &#205; String.fromCharCode(0x00CD)
Î &Icirc; &#206; String.fromCharCode(0x00CE)
Ï &Iuml; &#207; String.fromCharCode(0x00CF)
Ð &ETH; &#208; String.fromCharCode(0x00D0)
Ñ &Ntilde; &#209; String.fromCharCode(0x00D1)
Ò &Ograve; &#210; String.fromCharCode(0x00D2)
Ó &Oacute; &#211; String.fromCharCode(0x00D3)
Ô &Ocirc; &#212; String.fromCharCode(0x00D4)
Õ &Otilde; &#213; String.fromCharCode(0x00D5)
Ö &Ouml; &#214; String.fromCharCode(0x00D6)
× &times; &#215; String.fromCharCode(0x00D7)
Ø &Oslash; &#216; String.fromCharCode(0x00D8)
Ù &Ugrave; &#217; String.fromCharCode(0x00D9)
Ú &Uacute; &#218; String.fromCharCode(0x00DA)
Û &Ucirc; &#219; String.fromCharCode(0x00DB)
Ü &Uuml; &#220; String.fromCharCode(0x00DC)
Ý &Yacute; &#221; String.fromCharCode(0x00DD)
Þ &THORN; &#222; String.fromCharCode(0x00DE)
ß &szlig; &#223; String.fromCharCode(0x00DF)
à &agrave; &#224; String.fromCharCode(0x00E0)
á &aacute; &#225; String.fromCharCode(0x00E1)
â &acirc; &#226; String.fromCharCode(0x00E2)
ã &atilde; &#227; String.fromCharCode(0x00E3)
ä &auml; &#228; String.fromCharCode(0x00E4)
å &aring; &#229; String.fromCharCode(0x00E5)
æ &aelig; &#230; String.fromCharCode(0x00E6)
ç &ccedil; &#231; String.fromCharCode(0x00E7)
è &egrave; &#232; String.fromCharCode(0x00E8)
é &eacute; &#233; String.fromCharCode(0x00E9)
ê &ecirc; &#234; String.fromCharCode(0x00EA)
ë &euml; &#235; String.fromCharCode(0x00EB)
ì &igrave; &#236; String.fromCharCode(0x00EC)
í &iacute; &#237; String.fromCharCode(0x00ED)
î &icirc; &#238; String.fromCharCode(0x00EE)
ï &iuml; &#239; String.fromCharCode(0x00EF)
ð &eth; &#240; String.fromCharCode(0x00F0)
ñ &ntilde; &#241; String.fromCharCode(0x00F1)
ò &ograve; &#242; String.fromCharCode(0x00F2)
ó &oacute; &#243; String.fromCharCode(0x00F3)
ô &ocirc; &#244; String.fromCharCode(0x00F4)
õ &otilde; &#245; String.fromCharCode(0x00F5)
ö &ouml; &#246; String.fromCharCode(0x00F6)
÷ &divide; &#247; String.fromCharCode(0x00F7)
ø &oslash; &#248; String.fromCharCode(0x00F8)
ù &ugrave; &#249; String.fromCharCode(0x00F9)
ú &uacute; &#250; String.fromCharCode(0x00FA)
û &ucirc; &#251; String.fromCharCode(0x00FB)
ü &uuml; &#252; String.fromCharCode(0x00FC)
ý &yacute; &#253; String.fromCharCode(0x00FD)
þ &thorn; &#254; String.fromCharCode(0x00FE)
ÿ &yuml; &#255; String.fromCharCode(0x00FF)
ƒ &fnof; &#402; String.fromCharCode(0x0192)


Источник: anton-pribora.ru
текущее:

НОВОСТИ

2011 г., «VisMech.ru»