aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/string/blink/index.md
blob: c73d979e4904d9fce6f58b7773e8c50d610ee295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
title: String.prototype.blink()
slug: Web/JavaScript/Reference/Global_Objects/String/blink
tags:
  - Deprecated
  - HTML wrapper methods
  - JavaScript
  - Méthode
  - Prototype
  - Reference
  - String
translation_of: Web/JavaScript/Reference/Global_Objects/String/blink
original_slug: Web/JavaScript/Reference/Objets_globaux/String/blink
---
{{JSRef}}{{deprecated_header}}

La méthode **`blink()`** crée un élément HTML {{HTMLElement("blink")}} qui affiche la chaine de caractères en clignotant.

> **Attention :** Les textes clignotants sont fortement déconseillés par de nombreux standards d'accessibilité. L'élément `<blink>` est lui-même non standard et obsolète !

## Syntaxe

    str.blink()

### Valeur de retour

Une chaine de caractères représentant un élément HTML {{HTMLElement("blink")}}.

## Description

La méthode `blink()` place la chaine de caractères dans une balise `<blink>` :
`"<blink>str</blink>`"

## Exemples

L'exemple suivant utilise des méthodes de `String` pour changer l'affichage d'une chaine de caractères :

```js
var chaîneMonde = "Coucou monde";

console.log(chaîneMonde.blink());
console.log(chaîneMonde.bold());
console.log(chaîneMonde.italics());
console.log(chaîneMonde.strike());
```

Cet exemple produira le code HTML suivant :

```html
<blink>Coucou monde</blink>
<b>Coucou monde</b>
<i>Coucou monde</i>
<strike>Coucou monde</strike>
```

## Spécifications

| Spécification                                                                                                | État                         | Commentaires                                                                                                                                           |
| ------------------------------------------------------------------------------------------------------------ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| {{SpecName('ES6', '#sec-string.prototype.blink', 'String.prototype.blink')}}         | {{Spec2('ES6')}}         | Définition initiale. Implémentée avec JavaScript 1.0. Définie dans l'annexe B (normative) pour les fonctionnalités additionnelles des navigateurs web. |
| {{SpecName('ESDraft', '#sec-string.prototype.blink', 'String.prototype.blink')}} | {{Spec2('ESDraft')}} | Définie dans l'annexe B (normative) pour les fonctionnalités additionnelles des navigateurs web.                                                       |

## Compatibilité des navigateurs

{{Compat("javascript.builtins.String.blink")}}

## Voir aussi

- {{jsxref("String.prototype.bold()")}}
- {{jsxref("String.prototype.italics()")}}
- {{jsxref("String.prototype.strike()")}}