From cb9e359a51c3249d8f5157db69d43fd413ddeda6 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 14:45:12 +0100 Subject: unslug ca: move --- .../global_objects/string/link/index.html | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 files/ca/web/javascript/reference/global_objects/string/link/index.html (limited to 'files/ca/web/javascript/reference/global_objects/string/link') diff --git a/files/ca/web/javascript/reference/global_objects/string/link/index.html b/files/ca/web/javascript/reference/global_objects/string/link/index.html new file mode 100644 index 0000000000..efe1385ddc --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/string/link/index.html @@ -0,0 +1,119 @@ +--- +title: String.prototype.link() +slug: Web/JavaScript/Referencia/Objectes_globals/String/link +translation_of: Web/JavaScript/Reference/Global_Objects/String/link +--- +
{{JSRef}}
+ +

El mètode link() crea un element HTML {{HTMLElement("a")}} que causa que una cadena es mostri com un enllaç hipertext a una altra URL.

+ +

Sintaxi

+ +
str.link(url)
+ +

Paràmetres

+ +
+
url
+
Una cadena que especifica l'atribut href de l'etiqueta <a>: hauria de ser una URL vàlida (relativa o absoluta), amb qualsevols caràcters escapats & com &amp;, i qualsevol caràcter "  escapat com &quot;.
+
+ +

Descripció

+ +

Use the link() method to create an HTML snippet for a hypertext link. The returned string can then be added to the document via {{domxref("document.write()")}} or {{domxref("element.innerHTML")}}.

+ +

Links created with the link() method become elements in the links array of the document object. See {{domxref("document.links")}}.

+ +

Exemples

+ +

Utilitzar link()

+ +

L'exemple següent mostra la paraula "MDN" com a un enllaç hypertext lque retorna a l'usuari a la xarxa de Mozilla Developer.

+ +
var hotText = 'MDN';
+var URL = 'https://developer.mozilla.org/';
+
+console.log('Click to return to ' + hotText.link(URL));
+// Click to return to <a href="https://developer.mozilla.org/">MDN</a>
+
+ +

Especificacions

+ + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-string.prototype.link', 'String.prototype.link')}}{{Spec2('ES6')}}Definició inicial. Implementat en JavaScript 1.0. Definit en l'Annex B (normative) per Característiques Addiccionals d'ECMAScript per Navegadors Web.
+ +

Compatibilitat amb navegadors

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.0")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
CaracterísticaAndroidChrome per AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("1.0")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

Notes específiques Gecko

+ + + +

Vegeu també

+ + -- cgit v1.2.3-54-g00ecf