aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/api/document/body/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/pt-br/web/api/document/body/index.html')
-rw-r--r--files/pt-br/web/api/document/body/index.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/files/pt-br/web/api/document/body/index.html b/files/pt-br/web/api/document/body/index.html
new file mode 100644
index 0000000000..cb21522c4f
--- /dev/null
+++ b/files/pt-br/web/api/document/body/index.html
@@ -0,0 +1,44 @@
+---
+title: Document.body
+slug: Web/API/Document/body
+translation_of: Web/API/Document/body
+---
+<div>{{APIRef("DOM")}}</div>
+
+<p>Retorna o elemento {{HTMLElement("body")}} ou o {{HTMLElement("frameset")}} do documento atual, ou <code>null</code> se nenhum destes elementos existir.</p>
+
+<h2 id="Syntax" name="Syntax">Sintaxe</h2>
+
+<pre class="syntaxbox"><em>var objRef</em> = document.body;
+document.body = <em>objRef;</em></pre>
+
+<h2 id="Example" name="Example">Exemplo</h2>
+
+<pre class="brush:js">// No HTML: &lt;body id="oldBodyElement"&gt;&lt;/body&gt;
+alert(document.body.id); // "oldBodyElement"
+
+var aNewBodyElement = document.createElement("body");
+
+aNewBodyElement.id = "newBodyElement";
+document.body = aNewBodyElement;
+alert(document.body.id); // "newBodyElement"
+</pre>
+
+<h2 id="Notes" name="Notes">Notas</h2>
+
+<p><code>document.body</code> é o elemento que envolve o conteúdo do documento. Em documentos com conteúdo no <code>&lt;body&gt;</code>, retorna o elemento <code>&lt;body&gt;</code>, e em documentos que usam frameset, retorna o elemento <code>&lt;frameset&gt;</code> mais periférico.</p>
+
+<p>Apesar do <code>body</code> ser configurável, definir um novo <code>body</code> em um documento irá remover todos os elementos contidos no elemento <code>&lt;body&gt;</code> existente.</p>
+
+<h2 id="Specification" name="Specification">Especificação</h2>
+
+<ul>
+ <li><a class="external" href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-56360201">DOM Level 2 HTML: HTMLDocument.body</a></li>
+ <li><a class="external" href="http://www.w3.org/TR/html5/dom.html#dom-tree-accessors" title="http://www.w3.org/TR/html5/dom.html#dom-document-head">HTML5: DOM Tree Accessors</a></li>
+</ul>
+
+<h2 id="Veja_Também">Veja Também</h2>
+
+<ul>
+ <li>{{domxref("document.head")}}</li>
+</ul>