Posted on 2015-06-25 11:05
lxasp 阅读(571)
评论(0) 编辑 收藏 引用 所属分类:
AJAX
<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="content-type" content="text/html; charset=gbk" />
<style>/*<![CDATA[*/
.nl {
height: 20px;
margin: 0;
overflow: hidden;
padding: 0 0 0 16px;
text-overflow: ellipsis;
white-space: nowrap;
width: 200px;
}
.nl div {
font-size: 14px;
height: 20px;
line-height: 20px;
}
/*]]>*/</style>
</head>
<body>
<div id="n1" class="nl"><div>hello inner asp tpl 001</div>
<div>hello inner asp tpl 002</div>
<div>hello inner asp tpl 003</div></div>
<div id="n2" class="nl"><div>hello inner asp tpl 001</div><div>hello inner asp tpl 002</div></div>
<script type="text/javascript">/*<![CDATA[*/
vMarq=function(id,tag,heigh,speed,delay){
var me=this;
me.EL=document.getElementById(id);
me.PA=0;
me.TI=null;
me.LH=heigh;
me.SP=speed;
me.DY=delay;
me.exec=function(){
if(me.PA)return;
me.EL.scrollTop+=2;
if(me.EL.scrollTop%me.LH<=1){
clearInterval(me.TI);
me.EL.appendChild(me.EL.getElementsByTagName(tag)[0]);
me.EL.scrollTop=0;
setTimeout(me.start,me.DY*1000);
}
};
me.start=function(){
if(me.EL.scrollHeight-me.EL.offsetHeight>=me.LH)me.TI=setInterval(me.exec,me.SP);
};
me.EL.onmouseover=function(){me.PA=1};
me.EL.onmouseout=function(){me.PA=0};
setTimeout(me.start,me.DY*1000);
};
new vMarq("n1","div",20,40,3);
new vMarq("n2","div",20,40,3);
/*]]>*/</script>
</body>
</html>