<marquee>標籤
<marquee>標籤是成對出現的標籤,首標籤<marquee>和尾標籤</marquee>之間的內容就是滾動內容。
<marquee>標籤的屬性主要有behavior、bgcolor、direction、width、height、hspace、vspace、loop、scrollamount、scrolldelay等,它們都是可選的。
一. behavior屬性
behavior屬性的參數值爲alternate、scroll、slide中的一個,分別表示文字來回滾動、單方向循環滾動、只滾動一次,需要注意的是:如果在<marquee>標籤中同時出現了direction和behavior屬性,那麼scroll和slide的滾動方向將依照direction屬性中參數的設置。
<marquee behavior=”alternate”>我來回滾動</marquee>
<marquee behavior=”scroll”>我單方向循環滾動</marquee><marquee behavior=”scroll” direction=”up” height=”30”>我改單方向向上循環滾動</marquee> <marquee behavior=”slide”>我只滾動一次</marquee>
<marquee behavior=”slide” direction=”up”>我改向上只滾動一次了</marquee>
bgcolor屬性文字滾動範圍的背景顏色,參數值是16進制(形式:#AABBCC或#AA5566等)或預定義的顏色名字(如red、yellow、blue等)。如下所示:<marquee behavior==”slide” direction=”left” bgcolor=”red”>我的背景色是紅色的</marquee>
二.direction屬性
文字滾動的方向,屬性的參數值有down、left、right、up共四個單一可選值,分別代表滾動方向向下、向左、向右、向上。如下所示:
<marquee direction=”right”>我向右滾動</marquee>
<marquee direction=”right”>我向下滾動</marquee>
三.width和height屬性
width和height屬性的作用決定滾動文字在頁面中的矩形範圍大小。width屬性用以規定矩形的寬度,height屬性規定矩形的高度。這兩個屬性的參數值可以是數字或者百分數,數字表示矩形所佔的(寬或高)像素點數,百分數表示矩形所佔瀏覽器窗口的(寬或高)百分比。如下所示:
<marquee width=”300” height=”30” bgcolor=”red”>我寬300像素,高30像素。</marquee>
hspace和vspace屬性
這兩個屬性決定滾動矩形區域距周圍的空白區域.
<marquee width=”300” height=”30” vspace=”10” hspace=”10” bgcolor=”red”>我矩形邊緣水平和垂直距周圍各10像素。</marquee>
<marquee width=”300” height=”30” vspace=”50” hspace=”50” bgcolor=”red”>我矩形邊緣水平和垂直距周圍各50像素。</marquee>
四.loop屬性
loop屬性決定滾動文字的滾動次數,缺省是無限循環。參數值可以是任意的正整數,如果設置參數值爲-1或infinite時將無限循環。如下所示:
<marquee loop=”2”>我滾動2次。</marquee>
<marquee loop=”infinite”>我無限循環滾動。</marquee>
<marquee loop=”-1”>我無限循環滾動。</marquee>
五.scrollamount和scrolldelay屬性
這兩個屬性決定文字滾動的速度(scrollamount)和延時(scrolldelay),參數值都是正整數。如下所示:
<marquee scrollamount=”100”>我速度很快.</marquee>
<marquee scrollamount=”50”>我慢了些。</marquee>
<marquee scrolldelay=”30”>我小步前進。</marquee>
<marquee scrolldelay=”1000” scrollamount=”100”>我大步前進。</marquee>
最後說一下align屬性,這個屬性決定滾動文字位於距形內邊框的上下左右位置。您也可以將<marquee>和</marquee>之間的內容替換爲圖像或其它對象等
<marquee direction=”down” behavior=”alternate” height=”185”>sdsdsd</marquee></p>
<body onselectstart=”return false” bgcolor=”#F5F5F5”>
<div id=”marquees”>
<table width=”175” height=”80” border=”0”>
<tr>
<td height=”80”><a href=”about.aspx” target=”_blank” class=”linkslan”>我公司是全國機械工業標準化委員會”應變與振動儀器設備”國家標準工作組組長單位,主導並參與制定行業標準,保持多年業界技術領先地位。本公司視”不斷創新”做爲保持核心競爭力的關鍵,核心團隊在業界經營近”四十年“,7V系列產品早已成爲我國工程檢測界知名品牌,我方產品已成功用於神五發射架,太空艙,秦山核電二期,多座長江大橋,鞍鋼新一號高爐等諸多重要工程檢測應用中<br>
靜態數據採集7V系列產品,虛擬儀器技術,以太網動態工業測控DAQ系列產品,新興Zigbee技術,無線個人局域網WDAQ系列產品,全球率先推出的WDAQ1002/3型長期在線,應變信號智能傳感器無線網絡產品,爲工業自動化,工業檢測界,衡器等產品升級和技術創新提供OEM方式合作良機</a></td>
</tr>
</table>
</div>
<script language=”JavaScript“>
marqueesHeight=100;
stopscroll=false;
with(marquees){
style.width=0;
style.height=marqueesHeight;
style.overflowX=”visible”;
style.overflowY=”hidden”;
noWrap=true;
onmouseover=new Function(“stopscroll=true”);
onmouseout=new Function(“stopscroll=false”);
}
document.write(‘<div id=”templayer” style=”position:absolute;z-index:1;visibility:hidden”></div>’);
preTop=0; currentTop=0;
function init(){
templayer.innerHTML=”“;
while(templayer.offsetHeight<marqueesHeight){
templayer.innerHTML+=marquees.innerHTML;
}
marquees.innerHTML=templayer.innerHTML+templayer.innerHTML;
setInterval(“scrollUp()”,40);//越大越慢
}
document.body.onload=init;
function scrollUp(){
if(stopscroll==true) return;
preTop=marquees.scrollTop;
marquees.scrollTop+=1;
if(preTop==marquees.scrollTop){
marquees.scrollTop=templayer.offsetHeight-marqueesHeight;
marquees.scrollTop+=1;
}
}
</script>
<marquee direction=”right”>向右滾動</marquee>
<marquee direction=”down”>向下滾動</marquee>
<marquee direction=”left”>向左滾動</marquee>
<marquee direction=”right”>向上滾動</marquee>