js文字内容左右移动事件

<style type="text/css">
#gongao{width:500px;height:30px;overflow:hidden;line-height:30px;font-size:13px;font-family:'宋体';
background:#DDE5ED;color:#0C77CF;font-weight:bold; position: absolute;right: 20px;top: 100px;}
#gongao #scroll_begin, #gongao #scroll_end{display:inline}
</style>

<!-- js字体左右移动-->
<script type="text/javascript">
function ScrollImgLeft(){
var speed=50;  //设置调用时间
var scroll_div = document.getElementById("scroll_div");  //获取left需要移动的idv

function Marquee(){
if(scroll_div.scrollLeft>300)    
scroll_div.scrollLeft=0;
else
scroll_div.scrollLeft++;
}
var MyMar=setInterval(Marquee,speed);  //每多少秒调用一次该函数
scroll_div.οnmοuseοver=function() {clearInterval(MyMar);}  //鼠标移动停止移动事件
scroll_div.οnmοuseοut=function() {MyMar=setInterval(Marquee,speed);}  //离开运行移动
}

</script>
<div id="gongao">
<div style="width:500px;height:30px;margin:0 auto;white-space: nowrap;overflow:hidden;" id="scroll_div" class="scroll_div">
<div id="scroll_begin">
由于电信对座机号码设置的管控,公司现正式更换热线号码为:028-63433266 &nbsp;&nbsp;&nbsp;&nbsp;  
由于电信对座机号码设置的管控,公司现正式更换热线号码为:028-63433266 &nbsp;&nbsp;&nbsp;&nbsp;  
由于电信对座机号码设置的管控,公司现正式更换热线号码为:028-63433266 &nbsp;&nbsp;&nbsp;&nbsp;
</div>

</div>
<script type="text/javascript">setInterval(ScrollImgLeft(),1000);</script>
</div>
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值