aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/document/bgcolor/index.html
blob: d156c2d6176213a1bb84fa3d0bf7cd73f31703b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
title: document.bgColor
slug: Web/API/Document/bgColor
tags:
  - API
  - DOM
  - Deprecated
  - Document
  - Gecko
  - HTML DOM
  - Property
  - Reference
translation_of: Web/API/Document/bgColor
---
<p>{{APIRef("DOM")}} {{ Deprecated_header() }}</p>

<p>廃止された <code>bgColor</code> プロパティは、現在の文書の背景色を取得または設定します。</p>

<h2 id="Syntax" name="Syntax">構文</h2>

<pre class="syntaxbox"><em>color</em> = document.bgColor
document.bgColor =<em>color</em>
</pre>

<h3 id="Parameters" name="Parameters">引数</h3>

<ul>
 <li><code>color</code> : 色名 (<code>"white"</code> 等) またはカラーコード (<code>"#FFFFFF"</code> 等) の文字列</li>
</ul>

<h2 id="Example" name="Example"></h2>

<pre class="eval">document.bgColor = "darkblue";
</pre>

<h2 id="Notes" name="Notes">メモ</h2>

<p>Firefox ではこのプロパティの初期値は白 (16進表記で <code>#FFFFFF</code>) となっています。</p>

<p><code>document.bgColor</code><a class="external" href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268">DOM Level 2 HTML</a> で非推奨になっています。推奨される代替方法は、 CSS の {{Cssxref("background-color")}} を使用することで、 <code>document.body.style.backgroundColor</code> で DOM を通してアクセスできます。もう一つの代替手段である <code>document.body.bgColor</code> は、 HTML 4.01 で CSS に代替されたため非推奨となっています。</p>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>

<p>{{Compat("api.Document.bgColor")}}</p>