| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/String/link | [Back] [Original] |
Get to know MDN better
Esta pgina ha sido traducida del ingls por la comunidad. Aprende ms y nete a la comunidad de MDN Web Docs.
Avoid using this feature in new projects. HTML wrapper methods exist only for backwards compatibility. Use DOM APIs to create elements instead. This feature may be a candidate for removal from web standards or browsers.
Consider using the following features instead: DOM.
Crea un enlace de hipertexto HTML, <a>, que solicita otra URL.
cadena.link(atributoHref)
atributoHrefCualquier cadena que especifique el atributo href de la etiqueta <a>; debera ser una URL vlida (relativa o absoluta).
Usa el mtodo link para crear un atajo HTML para un enlace de hipertexto. La cadena devuelta puede ser aadida al documento va element.innerHTML.
Los enlaces creados con el mtodo link sern elementos del array links del objeto document. Vea document.links.
linkEl siguiente ejemplo muestra la palabra "Netscape" como un enlace de hipertexto que devuelve al usuario a la pgina inicial de Netscape:
var textoActivo = "MDN";
var URL = "https://developer.mozilla.org/";
console.log("Haga click para volver a " + textoActivo.link(URL));
Este ejemplo produce el mismo resultado que el siguiente cdigo HTML:
Haga click para volver a <a href="http://developer.mozilla.org/">MDN</a>
This page was last modified on 20 jun 2025 by MDN contributors.
StringString.prototype.anchor()at()String.prototype.big()String.prototype.blink()String.prototype.bold()String.prototype.charAt()String.prototype.charCodeAt()String.prototype.codePointAt()String.prototype.concat()String.prototype.endsWith()String.prototype.fixed()String.prototype.fontcolor()String.prototype.fontsize()String.prototype.includes()String.prototype.indexOf()isWellFormed()String.prototype.italics()String.prototype.lastIndexOf()String.prototype.link()String.prototype.localeCompare()String.prototype.match()String.prototype.matchAll()String.prototype.normalize()padEnd()String.prototype.padStart()String.prototype.repeat()String.prototype.replace()String.prototype.replaceAll()String.prototype.search()String.prototype.slice()String.prototype.small()String.prototype.split()String.prototype.startsWith()String.prototype.strike()String.prototype.sub()String.prototype.substr()String.prototype.substring()String.prototype.sup()String.prototype.toLocaleLowerCase()String.prototype.toLocaleUpperCase()String.prototype.toLowerCase()String.prototype.toString()String.prototype.toUpperCase()toWellFormed()String.prototype.trim()String.prototype.trimEnd()trimStart()String.prototype.valueOf()[Symbol.iterator]()Object/FunctionYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |