diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
| commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
| tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/javascript/reference/global_objects/string/anchor | |
| parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
| download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip | |
initial commit
Diffstat (limited to 'files/pt-br/web/javascript/reference/global_objects/string/anchor')
| -rw-r--r-- | files/pt-br/web/javascript/reference/global_objects/string/anchor/index.html | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/files/pt-br/web/javascript/reference/global_objects/string/anchor/index.html b/files/pt-br/web/javascript/reference/global_objects/string/anchor/index.html new file mode 100644 index 0000000000..99207cfb2d --- /dev/null +++ b/files/pt-br/web/javascript/reference/global_objects/string/anchor/index.html @@ -0,0 +1,76 @@ +--- +title: String.prototype.anchor() +slug: Web/JavaScript/Reference/Global_Objects/String/anchor +tags: + - Descontinuado + - JavaScript + - Prototipo + - Referencia + - String + - metodo +translation_of: Web/JavaScript/Reference/Global_Objects/String/anchor +--- +<div>{{JSRef}} {{deprecated_header}}</div> + +<div>O método <strong><code>anchor()</code></strong> cria uma string começando com uma tag inicial <code><a name="..."></code>, um texto e uma tag final <code></a></code>.</div> + +<div class="blockIndicator warning"> +<p>Não use este método. Ao invés, use <a href="https://wiki.developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model" title="https://wiki.developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model">DOM APIs</a>. Além disso, a especificação HTML não permite mais que o elemento <a> tenha um atributo <strong>"name"</strong>, portanto, esse método nem mesmo cria uma tag válida.</p> +</div> + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="syntaxbox notranslate"><code><var>str</var>.anchor(<var>name</var>)</code></pre> + +<h3 id="Parâmetros">Parâmetros</h3> + +<dl> + <dt><code>name</code></dt> + <dd>Uma string que deve representar o valor do atributo <em><code>name</code>.</em></dd> +</dl> + +<h3 id="Valor_retornado">Valor retornado</h3> + +<p>Uma string começando com uma tag de início <em><code><a name="name"></code></em>, depois o valor da string e, em seguida, uma tag de fim <em><code></a></code></em>.</p> + +<h2 id="Descrição">Descrição</h2> + +<p>Não use este método. Ao invés, use <a href="https://wiki.developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model" title="https://wiki.developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model">DOM APIs</a>. Além disso, a especificação HTML não permite mais que o elemento <em><code><a></code></em> tenha um atributo <strong>"name"</strong>, portanto, esse método nem mesmo cria uma tag válida.</p> + +<h2 id="Exemplos">Exemplos</h2> + +<h3 id="Usando_anchor">Usando <code>anchor()</code></h3> + +<pre class="brush: js notranslate">const nome = 'Ricardo'; +console.log(nome.anchor('https://developer.mozilla.org/pt-BR/)'); +</pre> + +<p>irá retornar o seguinte código HTML:</p> + +<pre class="brush: html notranslate">'<span class="message-body-wrapper"><span class="message-flex-body"><span class="devtools-monospace message-body"><span class="objectBox objectBox-string"><a name="<a class="url" href="https://developer.mozilla.org/pt-BR/" rel="noopener noreferrer" title="https://developer.mozilla.org/pt-BR/">https://developer.mozilla.org/pt-BR/</a>">Ricardo</a></span></span></span></span>' +</pre> + +<h2 id="Especificações">Especificações</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + </tr> + <tr> + <td>{{SpecName('ESDraft', '#sec-string.prototype.anchor', 'String.prototype.anchor')}}</td> + </tr> + </tbody> +</table> + +<h2 id="Navegadores_compatíveis">Navegadores compatíveis</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("javascript.builtins.String.anchor")}}</p> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li>{{jsxref("String.prototype.link()")}}</li> +</ul> |
