marquee在HTML中的属性解析
该标签是个容器标签
语法:
<marquee></marquee>以下是一个最简单的例子:
代码如下:
<marquee><font size=+3 color=red>Hello, World</font></marquee>下面这两个事件经常用到:
onMouseOut="this.start()" :用来设置鼠标移出该区域时继续滚动
onMouseOver="this.stop()":用来设置鼠标移入该区域时停止滚动
代码如下:
<marquee onMouseOut="this.start()" onMouseOver="this.stop()">onMouseOut="this.start()" :用来设置鼠标移出该区域时继续滚动 onMouseOver="this.stop()":用来设置鼠标移入该区域时停止滚动</marquee>这是一个完整的例子:
代码如下:
<marquee id="affiche" align="left" behavior="scroll" bgcolor="#FF0000" direction="up" height="300" width="200" hspace="50" vspace="20" loop="-1" scrollamount="10" scrolldelay="100" onMouseOut="this.start()" onMouseOver="this.stop()">这是一个完整的例子
</marquee>
该标签支持的属性多达11个:
align
设定<marquee>标签内容的对齐方式
absbottom:绝对底部对齐(与g、p等字母的最下端对齐)absmiddle:绝对中央对齐
baseline:底线对齐
bottom:底部对齐(默认)
left:左对齐
middle:中间对齐
right:右对齐
texttop:顶线对齐
top:顶部对齐
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns=" http://www.w3.org/1999/xhtml"><head><title>new document </title><meta name="generator" content="editplus" /><meta name="author" content="" /><meta name="keywords" content="" /><meta name="description" content="" /></head><body><div id="marquee_demo" style="overflow:hiddenwidth:100%text-align:centerborder:1px solid #0066cc"><table cellspacing="0" cellpadding="3" align="center" border="0"><tr><td id="marquee_product1" valign="top"><table width="100%" height="100" border="0" cellpadding="2" cellspacing="0"><tr><td><a href=" http://www.codefans.net "><img src=" http://www.codefans.net/jscss/demoimg/wall_s1.jpg" border=0></a></td><td><a href="/"><img src=" http://www.codefans.net/jscss/demoimg/wall_s2.jpg" border=0></a></td><td><a href="/"><img src=" http://www.codefans.net/jscss/demoimg/wall_s3.jpg" border=0></a></td><td><a href="/"><img src=" http://www.codefans.net/jscss/demoimg/wall_s4.jpg" border=0></a></td><td><a href=" http://www.codefans.net "><img src=" http://www.codefans.net/jscss/demoimg/wall_s5.jpg" border=0></a></td><td><a href="/"><img src=" http://www.codefans.net/jscss/demoimg/wall_s6.jpg" border=0></a></td><td><a href="/"><img src=" http://www.codefans.net/jscss/demoimg/wall_s7.jpg" border=0></a></td><td><a href=" http://www.codefans.net "><img src=" http://www.codefans.net/jscss/demoimg/wall_s8.jpg" border=0></a></td><td><a href="/"><img src=" http://www.codefans.net/jscss/demoimg/wall_s9.jpg" border=0></a></td></tr></table></td><td id="marquee_product2" valign="top"></td></tr></table></div><script type="text/javascript">var speed=30marquee_product2.innerHTML=marquee_product1.innerHTMLfunction Marquee(){ if(marquee_demo.scrollRight>=marquee_product1.scrollWidth){ marquee_demo.scrollLeft=0} else{ marquee_demo.scrollLeft++} } var MyMar=setInterval(Marquee,speed)marquee_demo.onmouseover=function(){clearInterval(MyMar)} marquee_demo.onmouseout=function(){MyMar=setInterval(Marquee,speed)} </script></body></html>欢迎分享,转载请注明来源:内存溢出
评论列表(0条)