This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

El mètode italics() crea un element HTML <i> que converteix una cadena en format itàlic.




El mètode italics() incrusta una cadena en una etiqueta <i>: "<i>str</i>".


Utilitzar italics()

L'exemple següent utilitza mètodes string per canviar el format de la cadena:

var worldString = 'Hola, món'; console.log(worldString.blink());  // Hello, world
console.log(worldString.bold());  // Hola, món
console.log(worldString.italics()); //Hola, món
console.log(worldString.strike());  // Hola, món


Especificació Estat Comentaris
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'String.prototype.italics' in that specification.
Standard Definició inicial. Implemtat en JavaScript 1.0. Definit en l'Annex B (normative) per Caracerístiques Adiccionals d'ECMAScript per navegadors Web.

Compatibilitat amb navegadors

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
Característica Chrome Firefox (Gecko) Internet Explorer Opera Safari
Suport bàsic (Yes) 1.0 (1.7 or earlier) (Yes) (Yes) (Yes)
Característica Android Chrome per Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Suport bàsic (Yes) (Yes) 1.0 (1.0) (Yes) (Yes) (Yes)

Vegeu també