htmlmarquee標簽使用示例介紹

字號:


    語法:
    <marquee></marquee>
    以下是一個最簡單的例子:
    代碼如下:
    <marquee><fontsize=+3color=red>hello,world</font></marquee>
    下面這兩個事件經(jīng)常用到:
    onmouseout=this.start():用來設置鼠標移出該區(qū)域時繼續(xù)滾動
    onmouseover=this.stop():用來設置鼠標移入該區(qū)域時停止?jié)L動
    代碼如下:
    <marqueeonmouseout=this.start()onmouseover=this.stop()>onmouseout=this.start():用來設置鼠標移出該區(qū)域時繼續(xù)滾動onmouseover=this.stop():用來設置鼠標移入該區(qū)域時停止?jié)L動</marquee>
    這是一個完整的例子:
    代碼如下:
    <marqueeid=affichealign=leftbehavior=scrollbgcolor=#ff0000direction=upheight=300width=200hspace=50vspace=20loop=-1scrollamount=10scrolldelay=100onmouseout=this.start()onmouseover=this.stop()>
    這是一個完整的例子
    </marquee>
    該標簽支持的屬性多達11個:
    align
    設定<marquee>標簽內(nèi)容的對齊方式
    absbottom:絕對底部對齊(與g、p等字母的最下端對齊)
    absmiddle:絕對中央對齊
    baseline:底線對齊
    bottom:底部對齊(默認)
    left:左對齊
    middle:中間對齊
    right:右對齊
    texttop:頂線對齊
    top:頂部對齊
    代碼如下:
    <marqueealign=absbottom>align=absbottom:絕對底部對齊(與g、p等字母的最下端對齊)。</marquee>
    <marqueealign=absmiddle>align=absmiddle:絕對中央對齊。</marquee>
    <marqueealign=baseline>align=baseline:底線對齊。</marquee>
    <marqueealign=bottom>align=bottom:底部對齊(默認)。</marquee>
    <marqueealign=left>align=left:左對齊。</marquee>
    <marqueealign=middle>align=middle:中間對齊。</marquee>
    <marqueealign=right>align=right:右對齊。</marquee>
    <marqueealign=texttop>align=texttop:頂線對齊。</marquee>
    <marqueealign=top>align=top:頂部對齊。</marquee>
    behavior
    設定滾動的方式:
    alternate:表示在兩端之間來回滾動。
    scroll:表示由一端滾動到另一端,會重復。
    slide:表示由一端滾動到另一端,不會重復。
    代碼如下:
    <marqueebehavior=alternate>alternate:表示在兩端之間來回滾動。</marquee>
    <marqueebehavior=scroll>scroll:表示由一端滾動到另一端,會重復。</marquee>
    <marqueebehavior=slide>slide:表示由一端滾動到另一端,不會重復。</marquee>
    bgcolor
    設定活動字幕的背景顏色,背景顏色可用rgb、16進制值的格式或顏色名稱來設定。
    代碼如下:
    <marqueebgcolor=#006699>設定活動字幕的背景顏色bgcolor=#006699</marquee>
    <marqueebgcolor=rgb(10%,50%,100%,)>設定活動字幕的背景顏色bgcolor=rgb(10%,50%,100%,)</marquee>
    <marqueebgcolor=red>設定活動字幕的背景顏色bgcolor=red</marquee>
    direction
    設定活動字幕的滾動方向
    代碼如下:
    復制代碼代碼如下:
    <marqueedirection=down>設定活動字幕的滾動方向direction=down:向下</marquee>
    <marqueedirection=left>設定活動字幕的滾動方向direction=left:向左</marquee>
    <marqueedirection=right>設定活動字幕的滾動方向direction=right:向右</marquee>
    <marqueedirection=up>設定活動字幕的滾動方向direction=up:向上</marquee>
    height
    設定活動字幕的高度
    代碼如下:
    <marqueeheight=500direction=downbgcolor=#cccccc>設定活動字幕的高度height=500</marquee>
    width
    設定活動字幕的寬度
    代碼如下:
    復制代碼代碼如下:
    <marqueewidth=500bgcolor=#cccccc>設定活動字幕的寬度width=500</marquee>
    hspace
    設定活動字幕里所在的位置距離父容器水平邊框的距離
    thiscontrolsthehorizontal(水平)spacearoundthedisplaybox.
    碼代碼如下:
    <tablewidth=500border=1align=centercellpadding=0cellspacing=0>
    <tr>
    <td><marqueehspace=100bgcolor=#cccccc>hspace=100</marquee></td>
    </tr>
    </table>
    vspace
    設定活動字幕里所在的位置距離父容器垂直邊框的距離
    thiscontrolsthevertical(垂直)spacearoundthedisplaybox.
    代碼如下:
    <marqueevspace=100bgcolor=#cccccc>hspace=100</marquee>
    loop
    設定滾動的次數(shù),當loop=-1表示一直滾動下去,默認為-1
    代碼如下:
    <marqueeloop=-1bgcolor=#cccccc>我會不停地走。</marquee>
    <p>&nbsp;</p>
    <marqueeloop=2bgcolor=#cccccc>我只走兩次哦</marquee>
    scrollamount
    設定活動字幕的滾動速度,單位pixels
    代碼如下:
    <marqueescrollamount=10>scrollamount=10</marquee>
    <marqueescrollamount=20>scrollamount=20</marquee>
    <marqueescrollamount=30>scrollamount=30</marquee>
    scrolldelay
    設定活動字幕滾動兩次之間的延遲時間,單位millisecond(毫秒)
    值大了會有一步一停頓的效果
    代碼如下:
    <marqueescrolldelay=10>scrolldelay=10</marquee>
    <marqueescrolldelay=100>scrolldelay=100</marquee>
    <marqueescrolldelay=1000>scrolldelay=1000</marquee>