Warning: Trying to access array offset on value of type bool in /www/wwwroot/zklhy.com/wp-content/themes/twentyfifteen/functions.php on line 544

Warning: Trying to access array offset on value of type bool in /www/wwwroot/zklhy.com/wp-content/themes/twentyfifteen/functions.php on line 553

marquee标签无缝滚动

没有什么废话可说的了  只是今天用到了 记下来罢了!

直接上代码:

<MARQUEE behavior="scroll" contenteditable="true" onstart="this.firstChild.innerHTML+=this.firstChild.innerHTML;" scrollamount="3" width="1370px"><SPAN unselectable="on"></SPAN></MARQUEE>
<DIV id="scrollobj" style="white-space:nowrap;overflow:hidden;width:1370px;margin:0 auto;" onmouseover="aa()" onmouseout="b()" >
<a href="http://zklhy.com" target="_Blank"><img alt="我的图片描述" title="我是图片标题" src="http://www.zklhy.com/wp-content/uploads/2016/04/52.jpg"></a>
</div>
<script language="javascript" type="text/javascript">
<!--
	function scroll(obj) {
		var tmp = (obj.scrollLeft)++;
		//当滚动条到达右边顶端时
		if (obj.scrollLeft==tmp) obj.innerHTML += obj.innerHTML;
		//当滚动条滚动了初始内容的宽度时滚动条回到最左端
		if (obj.scrollLeft>=obj.firstChild.offsetWidth) obj.scrollLeft=0;
	}
	var a =	setInterval("scroll(document.getElementById('scrollobj'))",20);
	function aa(){
		clearInterval(a);
	}
	function b(){
		a=setInterval("scroll(document.getElementById('scrollobj'))",10);
	}
//-->
</script>

direction表示滚动的方向,值可以是left,right,up,down,默认为left
◎ behavior表示滚动的方式,值可以是scroll(连续滚动)slide(滑动一次)alternate(往返滚动)
◎ loop表示循环的次数,值是正整数,默认为无限循环
◎ scrollamount表示运动速度,值是正整数,默认为6
◎ scrolldelay表示停顿时间,值是正整数,默认为0,单位似乎是毫秒
◎ align表示元素的垂直对齐方式,值可以是top,middle,bottom,默认为middle
◎ bgcolor表示运动区域的背景色,值是16进制的RGB颜色,默认为白色
◎ height、width表示运动区域的高度和宽度,值是正整数(单位是像素)或百分数,默认width=100% height为标签内元素的高度
◎ hspace、vspace表示元素到区域边界的水平距离和垂直距离,值是正整数,单位是像素。
◎ onmouseover=this.stop() onmouseout=this.start()表示当鼠标以上区域的时候滚动停止,当鼠标移开的时候又继续滚动。

发表回复