js跑马灯代码(自写)_Javascript教程-查字典教程网
js跑马灯代码(自写)
js跑马灯代码(自写)
发布时间:2016-12-30 来源:查字典编辑
摘要:复制代码代码如下:functioncls_marquee(id,id1,id2,sp){this.obj_id=id;this.obj_id...

复制代码 代码如下:

function cls_marquee(id,id1,id2,sp){

this.obj_id=id;

this.obj_id1=id1;

this.obj_id2=id2;

this.speed=sp;

eval(this.obj_id2+".innerHTML="+this.obj_id1+".innerHTML");

function Marquee(){

if(eval(id2).offsetTop-eval(id).scrollTop<=0)

eval(id).scrollTop-=eval(id1).offsetHeight

else{

eval(id).scrollTop++

}

}

var MyMar=setInterval(Marquee,sp)

eval(this.obj_id).onmouseover=function() {clearInterval(MyMar)}

eval(this.obj_id).onmouseout=function() {MyMar=setInterval(Marquee,sp)}

}

自己刚写的一个小程序,写得满一般的。。。。不过这个接口还成

复制代码 代码如下:

<script type="text/javascript" >

function show() {

var info = document.getElementById('Text1');

info.value = info.value.substr(1) + info.value[0];

}

setInterval(show, 500);

function show1() {

var info1 = document.getElementById('Text2');

info1.value = info1.value[info1.value.length-1] + info1.value.substr(0, info1.value.length-1);

}

setInterval(show1, 500);

</script>

<input id="Text1" type="text" value="欢迎来测试" />

<input id="Button1" type="button" value="滚动"/><br />

<input id="Text2" type="text" value="北京欢迎您" />

<input id="Button2" type="button" value="滚动" />

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新Javascript教程学习
    热门Javascript教程学习
    编程开发子分类