blob: 3b6a754c831fa793b14676db01d3048c8beeb344 (
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
101
102
103
104
105
106
107
108
109
110
111
112
|
---
title: <marquee>:捲動元素(已過時)
slug: Web/HTML/Element/marquee
translation_of: Web/HTML/Element/marquee
---
<p>HTML <code><marquee></code> 元素用作插入一段文字的捲動區域。你可以透過屬性,控制文字在到達邊緣後的應對動作。</p>
<table class="properties">
<tbody>
<tr>
<th scope="row">DOM 介面</th>
<td>{{DOMxRef("HTMLMarqueeElement")}}</td>
</tr>
</tbody>
</table>
<h2 id="屬性">屬性</h2>
<dl>
<dt>{{htmlattrdef("behavior")}}</dt>
<dd>設定文字如何在 marquee 內捲動。可用值為 <code>scroll</code>、<code>slide</code>、<code>alternate</code>。若無指定,預設值為 <code>scroll</code>。</dd>
<dt>{{htmlattrdef("bgcolor")}}</dt>
<dd>透過色彩名或十六進位值指定背景顏色。</dd>
<dt>{{htmlattrdef("direction")}}</dt>
<dd>設定 marquee 內的捲動方向。可用值為 <code>left</code>、<code>right</code>、<code>up</code>、<code>down</code>。若無指定,預設值為 <code>left</code>。</dd>
<dt>{{htmlattrdef("height")}}</dt>
<dd>設定像素或百分比高度。</dd>
<dt>{{htmlattrdef("hspace")}}</dt>
<dd>設定橫向外邊(horizontal margin)</dd>
<dt>{{htmlattrdef("loop")}}</dt>
<dd>設定 marquee 捲動的次數。若無指定,預設值為 -1,意思是的 marquee 將持續捲動。</dd>
<dt>{{htmlattrdef("scrollamount")}}</dt>
<dd>以像素為單位,設定捲動的間隔量。預設值為 6。</dd>
<dt>{{htmlattrdef("scrolldelay")}}</dt>
<dd>設定每次捲動時之間間隔的毫秒。預設值為 85。請注意,除非指定了 <code>truespeed</code>,否則小於 60 的數字會被忽略,並值使用 60。</dd>
<dt>{{htmlattrdef("truespeed")}}</dt>
<dd><code>scrolldelay</code> 預設上會忽略低於 60 的值。但如果有 <code>truespeed</code> 的話,就不會忽略此值。</dd>
<dt>{{htmlattrdef("vspace")}}</dt>
<dd>以像素或百分比值設置垂直邊距。</dd>
<dt>{{htmlattrdef("width")}}</dt>
<dd>設置以像素或百分比值為單位的寬度。</dd>
</dl>
<h2 id="Event_handlers" name="Event_handlers">事件處理器</h2>
<dl>
<dt>{{htmlattrdef("onbounce")}}</dt>
<dd>marquee 滾動到結尾時觸發。只能在 behavior 屬性設置為 <code>alternate</code> 時觸發。</dd>
<dt>{{htmlattrdef("onfinish")}}</dt>
<dd>marquee 完成 loop 屬性的設定值時觸發。只能在 loop 屬性設為大於 0 的數字時觸發。</dd>
<dt>{{htmlattrdef("onstart")}}</dt>
<dd>marquee 開始捲動時觸發。</dd>
</dl>
<h2 id="Methods" name="Methods">方法</h2>
<dl>
<dt>start()</dt>
<dd>開始 marquee 的捲動</dd>
<dt>stop()</dt>
<dd>停止 marquee 的捲動</dd>
</dl>
<h2 id="示例">示例</h2>
<pre class="brush: html"><marquee>This text will scroll from right to left</marquee>
<marquee direction="up">This text will scroll from bottom to top</marquee>
<marquee direction="down" width="250" height="200" behavior="alternate" style="border:solid">
<marquee behavior="alternate">
This text will bounce
</marquee>
</marquee></pre>
<p>{{EmbedLiveSample("Examples", 600, 450)}}</p>
<h2 id="規範">規範</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">規範</th>
<th scope="col">狀態</th>
<th scope="col">註解</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('HTML WHATWG', 'obsolete.html#the-marquee-element-2', '<marquee>')}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td>為了利於 CSS 而令其過時,但為了向下相容,還是定義了預期行為。不過 CSS 的 marquee 功能<a href="https://www.w3.org/TR/css3-marquee/">已經停止開發</a>。</td>
</tr>
<tr>
<td>{{SpecName('HTML5 W3C', 'obsolete.html#the-marquee-element-0', '<marquee>')}}</td>
<td>{{Spec2('HTML5 W3C')}}</td>
<td>為了利於 CSS 而令其過時,但為了向下相容,還是定義了預期行為。不過 CSS 的 marquee 功能<a href="https://www.w3.org/TR/css3-marquee/">已經停止開發</a>。</td>
</tr>
</tbody>
</table>
<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
<p>{{Compat("html.elements.marquee")}}</p>
<h2 id="參見">參見</h2>
<ul>
<li>{{DOMxRef("HTMLMarqueeElement")}}</li>
</ul>
|