aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/svg/element/script/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/pt-br/web/svg/element/script/index.html')
-rw-r--r--files/pt-br/web/svg/element/script/index.html129
1 files changed, 129 insertions, 0 deletions
diff --git a/files/pt-br/web/svg/element/script/index.html b/files/pt-br/web/svg/element/script/index.html
new file mode 100644
index 0000000000..7468e98706
--- /dev/null
+++ b/files/pt-br/web/svg/element/script/index.html
@@ -0,0 +1,129 @@
+---
+title: script
+slug: Web/SVG/Element/script
+tags:
+ - Elemento
+ - Referencia
+ - SVG
+translation_of: Web/SVG/Element/script
+---
+<p>Um elemento <code>script</code> é equivalente a um elemento <a href="/pt-BR/HTML/Element/Script"><code>script</code></a> em HTML e, portanto, é o lugar para os scripts (por exemplo, ECMAScript).</p>
+
+<p>Quaisquer funções definidas dentro de qualquer elemento <code>script</code> tem um escopo global em todo o documento atual.</p>
+
+<h2 id="Contexto_de_uso">Contexto de uso</h2>
+
+<p>{{svginfo}}</p>
+
+<h2 id="Exemplo">Exemplo</h2>
+
+<p>O seguinte trecho de código demonstra o uso da tag <code>script</code> do SVG. Neste código, nós usamos o JavaScript para alterar o raio do elemento SVG {{SVGElement("circle")}}.</p>
+
+<pre class="brush: html">&lt;svg width="100%" height="100%" viewBox="0 0 100 100"
+ xmlns="http://www.w3.org/2000/svg"&gt;
+ &lt;script type="text/javascript"&gt;
+ // &lt;![CDATA[
+ function change(evt) {
+      var target = evt.target;
+      var radius = target.getAttribute("r");
+
+      if (radius == 15) {
+        radius = 45;
+      } else {
+        radius = 15;
+      }
+
+      target.setAttribute("r",radius);
+ }
+ // ]]&gt;
+ &lt;/script&gt;
+
+ &lt;circle cx="50" cy="50" r="45" fill="green"
+          onclick="change(evt)" /&gt;
+&lt;/svg&gt;
+</pre>
+
+<p>Resultado:</p>
+
+<p>{{EmbedLiveSample("Exemplo",150,165)}}</p>
+
+<h2 id="Atributos">Atributos</h2>
+
+<h3 id="Atributos_globais">Atributos globais</h3>
+
+<ul>
+ <li><a href="/pt-BR/SVG/Attribute#Core">Atributos principais</a> »</li>
+ <li><a href="/pt-BR/SVG/Attribute#XLink">Atributos XLink</a> »</li>
+ <li>{{SVGAttr("externalResourcesRequired")}}</li>
+</ul>
+
+<h3 id="Atributos_específicos">Atributos específicos</h3>
+
+<ul>
+ <li>{{SVGAttr("type")}}</li>
+ <li>{{SVGAttr("xlink:href")}}</li>
+</ul>
+
+<h2 id="DOM_interface">DOM interface</h2>
+
+<p>Este elemento implementa a interface do <code><a href="/pt-BR/DOM/SVGScriptElement">SVGScriptElement</a></code>.</p>
+
+<h2 id="Compatibilidade_dos_navegadores">Compatibilidade dos navegadores</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Recurso</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Suporte básico</td>
+ <td>1.0</td>
+ <td>{{CompatGeckoDesktop('1.8')}}</td>
+ <td>{{CompatIE('9.0')}}</td>
+ <td>{{CompatOpera('9.0')}}</td>
+ <td>{{CompatSafari('3.0.4')}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Recurso</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Suporte básico</td>
+ <td>{{CompatAndroid('3.0')}}</td>
+ <td>{{CompatGeckoMobile('1.8')}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatSafari('3.0.4')}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>A tabela é baseada <a href="/pt-BR/SVG/Compatibility_sources">nessas fontes</a>.</p>
+
+<h2 id="Veja_também">Veja também</h2>
+
+<ul>
+ <li><a href="/pt-BR/HTML/Element/Script">Elemento <code>script</code> em HTML</a></li>
+</ul>
+
+<p>{{SVGRef}}</p>