下面這兩個事件經常用到:
onMouseOut="this.start()" :用來設定滑鼠移出該區域時繼續滾動
onMouseOver="this.stop()":用來設定滑鼠移入該區域時停止滾動
代碼如下:
<marquee onMouseOut="this.start()" onMouseOver="this.stop()">onMouseOut="this.start()" :用來設定滑鼠移出該區域時繼續滾動 onMouseOver="this.stop()":用來設定滑鼠移入該區域時停止滾動</marquee>
該标簽支援的屬性多達11個:
align
設定<marquee>标簽内容的對齊方式
absbottom:絕對底部對齊(與g、p等字母的最下端對齊)
absmiddle:絕對中央對齊
baseline:底線對齊
bottom:底部對齊(預設)
left:左對齊
middle:中間對齊
right:右對齊
texttop:頂線對齊
top:頂部對齊
behavior
設定滾動的方式:alternate: 表示在兩端之間來復原動。
scroll: 表示由一端滾動到另一端,會重複。
slide: 表示由一端滾動到另一端,不會重複。
direction
設定活動字幕的滾動方向
代碼如下:
<marquee direction="down">設定活動字幕的滾動方向direction="down":向下</marquee>
<marquee direction="left">設定活動字幕的滾動方向direction="left":向左</marquee>
<marquee direction="right">設定活動字幕的滾動方向direction="right":向右</marquee>
<marquee direction="up">設定活動字幕的滾動方向direction="up":向上</marquee>
height
設定活動字幕的高度
width
設定活動字幕的寬度
hspace
設定活動字幕裡所在的位置距離父容器水準邊框的距離
This controls the horizontal(水準)space around the display box.
代碼如下:
<table width="500" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><marquee hspace="100" bgcolor="#CCCCCC">hspace="100"</marquee></td>
</tr>
</table>
vspace
設定活動字幕裡所在的位置距離父容器垂直邊框的距離
This controls the vertical(垂直) space around the display box.
代碼如下:
<marquee vspace="100" bgcolor="#CCCCCC">hspace="100"</marquee>
loop
設定滾動的次數,當loop=-1表示一直滾動下去,預設為-1
代碼如下:
<marquee loop="-1" bgcolor="#CCCCCC">我會不停地走。</marquee>
<p> </p>
<marquee loop="2" bgcolor="#CCCCCC">我隻走兩次哦</marquee>
scrollamount
設定活動字幕的滾動速度,機關pixels
代碼如下:
<marquee scrollamount="10" >scrollamount="10" </marquee>
<marquee scrollamount="20" >scrollamount="20" </marquee>
<marquee scrollamount="30" >scrollamount="30" </marquee>
scrolldelay
設定活動字幕滾動兩次之間的延遲時間,機關millisecond(毫秒)
值大了會有一步一停頓的效果
代碼如下:
<marquee scrolldelay="10" >scrolldelay="10" </marquee>
<marquee scrolldelay="100" > scrolldelay="100"</marquee>
<marquee scrolldelay="1000">scrolldelay="1000" </marquee>