FrontPage 雖有跑馬燈元件,但僅支援單行;Dreamweaver 需手寫代碼,卻能實現多行、垂直、交替、滑鼠暫停等豐富效果。建議用記事本編輯原始碼以防 FrontPage 破壞結構。
<marquee scrollAmount="2" width="300">跑馬燈文字</marquee>
| 屬性 | 說明 | 建議值 |
|---|---|---|
scrollAmount | 移動速度(像素/幀),值越大越快 | 1~3(預設 6 太快) |
width / height | 顯示區域寬高,垂直滾動必設 height | 視版面而定 |
direction | 滾動方向 | left(預設)/right/up/down |
scrollDelay | 幀延遲(毫秒),值越大越慢 | 預設 90,通常不需調整 |
behavior | 滾動模式 | scroll(預設循環)/alternate(來回)/slide(滑入停止) |
<marquee scrollAmount="2" width="300">
<a href="https://www.cctv.com">中央電視台</a>
</marquee>
<marquee scrollAmount="2" width="300"
onmouseover="this.stop()" onmouseout="this.start()">
文字內容
</marquee>
<marquee scrollAmount="2" width="99" behavior="alternate">
文字內容
</marquee>
<marquee scrollAmount="2" width="300" height="160" direction="up">
·早晨好啊!<br>
·空氣好清新啊<br>
·今朝食乜好呢?<p>
·<a href="https://www.cctv.com">中央電視台</a>
</marquee>
若頁面曾用 FrontPage 儲存,<marquee> 內部標籤順序會被重排,導致只滾動第一行。解決辦法:將完整 <marquee> 區塊包裹在 document.write() 中輸出:
<script>
document.write('<marquee scrollAmount="2" width="300" height="160" direction="up">'
+ '·早晨好啊!<br>'
+ '·空氣好清新啊<br>'
+ '·今朝食乜好呢?<p>'
+ '·<a href="https://www.cctv.com">中央電視台</a>'
+ '</marquee>');
</script>
結論:HTML 標籤可自由組合,<marquee> 仍是簡單跑馬燈的輕量選擇,但現代專案建議改用 CSS Animation 或 JavaScript 實現更佳控制與無障礙支援。