blob: 5bc998b30330b447051b8911cff19091fc8df5f8 (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
---
title: <bgsound>
slug: Web/HTML/Element/bgsound
translation_of: Web/HTML/Element/bgsound
---
<div>{{non-standard_header}}</div>
<h2 id="概要">概要</h2>
<p><bgsound>是IE浏览器中设置网页背景音乐的元素。</p>
<div class="note">
<p><strong>不要使用它!</strong>想要在网页中嵌入音频,应当使用{{HTMLElement("audio")}}.</p>
</div>
<h2 id="属性">属性</h2>
<dl>
<dt>{{htmlattrdef("balance")}}</dt>
<dd>该属性取值在-10,000到+10,000,它决定扬声器之间的音量如何分配。</dd>
<dt>{{htmlattrdef("loop")}}</dt>
<dd>该属性表明音频被播放的次数,是一个数值或者关键字infinite。</dd>
<dt>{{htmlattrdef("src")}}</dt>
<dd>该属性定义了音频文件的URL,必须是以下格式之一:.wav,.au,.mid</dd>
<dt>{{htmlattrdef("volume")}}</dt>
<dd>该属性值域为-10,000到0,它决定背景音乐的音量大小。</dd>
</dl>
<h2 id="示例">示例</h2>
<pre class="brush:html"><bgsound src="sound1.mid">
<bgsound src="sound2.au" loop="infinite">
</pre>
<h2 id="备注">备注</h2>
<p>类似的功能在一些版本的Netscape中使用<embed>标签来调用音频播放器。</p>
<p>你可以使用自闭合标签<code><bgsound />。然后由于它并非标准的一部分,XHTML会认为它无效。</code></p>
<h2 id="浏览器兼容">浏览器兼容</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatNo}} [1]</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Mobile</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatNo}} [1]</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
</tr>
</tbody>
</table>
</div>
<p>[1] Up to Firefox 22, even if not supporting this element, Gecko was associating it an {{domxref("HTMLSpanElement")}}. This was fixed then and now the associated element is an {{domxref("HTMLUnknownElement")}} as required by the specification.</p>
<h2 id="参见">参见</h2>
<ul>
<li>The {{htmlelement("audio")}}, which is the standard element to embed audio in a document.</li>
</ul>
<div>{{HTMLRef}}</div>
|