以下是一段可製作跑馬燈公告欄的 HTML 程式碼,並附上各參數的詳細說明,方便你依需求調整效果。
<div align="center">
<table style="color:white; font-size:10pt" border="1" bordercolor="#FF9900">
<td background="圖檔網址.gif">
<p>
<font color="#FFFF00" face="新細明體" size="2">
<marquee scrollamount='2' scrolldelay='150' direction='up' width='105' id=xiaoqing height='120' onmouseover=xiaoqing.stop() onmouseout=xiaoqing.start() style="color: #0000FF; font-size: 10pt; font-weight: bold; font-family:新細明體">文字跑馬燈公告欄<br>在這輸入文字內容<br></marquee>
</font></td></table>
div align="center":讓文字公告欄置中。center 為居中、left 為靠左、right 為靠右。
color:white:設定公告欄文字顏色。
bordercolor="#FF9900":設定框線顏色(橘色)。
<td background="圖檔網址.gif">:設定儲存格背景圖,此項可有可無。
<font color="#FFFF00">:設定公告欄內容的文字顏色。
face="新細明體" size="2":設定文字字體與大小。
scrollamount='2' scrolldelay='150':控制跑馬燈速度,數值越大跑得越慢。
direction='up':設定文字跑馬燈的移動方向,可選值如下:
往左=left、往右=right、往上=up、往下=down、左右來回=alternate。
width='105' id=xiaoqing height='120':設定跑馬燈公告欄的寬度與高度。
onmouseover=xiaoqing.stop() 與 onmouseout=xiaoqing.start():滑鼠移入時停止滾動、移出時恢復滾動。
<br>:換行語法。