HTML元素 - marqueee

来源:互联网 时间:1970-01-01



Creates a scrolling text marquee.


MARQUEE 元素的默认宽度与其父元素的宽度相等。如果 MARQUEE 位于没有指定宽度的 TD 内,你就需要明确指定 MARQUEE 的宽度。如果 MARQUEE 和 TD 的宽度都没有指定,那么滚动字幕就将限定于 1 个像素宽。

要创建垂直滚动的字幕,请将其 scrollLeft 属性设定为 0。要创建水平滚动的字幕,请将其 scrollTop 属性设定为 0,这将覆盖任何脚本设置。

scrollLeft 和 scrollTop 属性当字幕滚动时为只读。当不处于滚动状态时,scrollLeft 对于设置为水平滚动的字幕来说为可读写,scrollTop 对于设置为垂直滚动的字幕来说为可读写。

此元素在 Internet Explorer 3.0 及以上版本的 HTML 中可用,在 Internet Explorer 4.0 及以上版本的脚本中可用。



The default width of the MARQUEE element is equal to the width of its parent element. When a MARQUEE is in a TD that does not specify a width, you should explicitly set the width of MARQUEE. If neither the MARQUEE nor the TD has a width specified, the marquee is collapsed to a 1-pixel width.

To create a vertically scrolling marquee, set its scrollLeft property to 0. To create a horizontally scrolling marquee, set its scrollTop property to 0, overriding any script setting.

The scrollLeft and scrollTop properties are read-only while the marquee is scrolling. When not scrolling, scrollLeft is read/write for a marquee set to scroll horizontally and scrollTop is read/write for a marquee set to scroll vertically.

This element is available in HTML as of Internet Explorer 3.0, and in script as of Internet Explorer 4.0.

This element is a block element.

This element requires a closing tag.


下面的例子使用了 MARQUEE 元素创建了由左向右的滚动字幕,移动速度为每 200 毫秒 10 像素。

The following example uses the MARQUEE element to scroll the marquee from left to right across the screen, moving it 10 pixels every 200 milliseconds.





下面的例子显示了 marquee 元素的 scrollLeft 和 scrollTop 属性的一些用途。

The following example shows some uses of the scrollLeft and scrollTop properties with the marquee element.

<MARQUEE id=m1 direction=right style="border-width:2px;border-style:solid;"

width=200 height=200>right</MARQUEE><BR>

<!-- Push this button to read the scrollLeft and scrollTop property values

as the marquee scrolls. -->

<BUTTON onclick="alert('scrollLeft: ' + m1.scrollLeft + ' scrollRight: ' + m1.scrollTop)">


<!--When the marquee is stopped, you can set scrollLeft in a horizontal marquee,

or set scrollTop in a vertical marquee. -->

<BUTTON onclick="m1.stop();m1.scrollLeft = 190;">Stop & Set scrollLeft=190


<BUTTON onclick="m1.start();">Start</BUTTON>



This object is a Microsoft extension to HTML.