欢迎来到代码驿站!

JavaScript代码

当前位置:首页 > 网页前端 > JavaScript代码

js跑马灯代码(自写)

时间:2021-06-25 09:28:06|栏目:JavaScript代码|点击:
复制代码 代码如下:

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="滚动" onclick="show1()" />

上一篇:javascript 从if else 到 switch case 再到抽象

栏    目:JavaScript代码

下一篇:JavaScript中的Truthy和Falsy介绍

本文标题:js跑马灯代码(自写)

本文地址:http://www.codeinn.net/misctech/147877.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有