<marquee>:选框元素

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

<marquee> HTML 元素用于插入文本滚动区域。你可以使用其属性控制文本到达其内容区域边缘时发生的情况。

¥The <marquee> HTML element is used to insert a scrolling area of text. You can control what happens when the text reaches the edges of its content area using its attributes.

属性

¥Attributes

behavior Deprecated

设置文本在选取框内滚动的方式。可能的值为 scrollslidealternate。如果未指定值,则默认值为 scroll

bgcolor Deprecated

通过颜色名称或十六进制值设置背景颜色。

direction Deprecated

设置选取框内的滚动方向。可能的值为 leftrightupdown。如果未指定值,则默认值为 left

height Deprecated

设置高度(以像素或百分比值为单位)。

hspace Deprecated

设置水平边距

loop Deprecated

设置选取框滚动的次数。如果没有指定值,则默认值为-1,这意味着选取框将连续滚动。

scrollamount Deprecated

设置每个间隔的滚动量(以像素为单位)。默认值为 6。

scrolldelay Deprecated

设置每次滚动运动之间的间隔(以毫秒为单位)。默认值为 85。请注意,任何小于 60 的值都将被忽略,并使用值 60 代替,除非指定了 truespeed

truespeed Deprecated

默认情况下,低于 60 的 scrolldelay 值将被忽略。如果存在 truespeed,则不会忽略这些值。

vspace Deprecated

设置垂直边距(以像素或百分比值为单位)。

width Deprecated

设置宽度(以像素或百分比值为单位)。

事件处理程序

¥Event handlers

onbounce Deprecated

当选取框到达其滚动位置的末尾时触发。仅当行为属性设置为 alternate 时才会触发。

onfinish Deprecated

当选取框完成循环属性设置的滚动量时触发。仅当循环属性设置为大于 0 的某个数字时才会触发。

onstart Deprecated

当选取框开始滚动时触发。

方法

¥Methods

start() Deprecated

开始滚动选取框。

stop() Deprecated

停止滚动选取框。

示例

¥Examples

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>

结果

¥Result

技术总结

¥Technical summary

DOM 接口 HTMLMarqueeElement

规范

Specification
HTML Standard
# the-marquee-element-2

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also