js跑馬燈代碼(自寫)
更新時間:2013年04月17日 11:44:04 作者:
自己剛寫的一個小程序,寫得滿一般的,不過這個接口還成,感興趣的朋友可以參考下哈,希望對你學習js知識有所幫助
復制代碼 代碼如下:
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原型對象、構造函數和實例對象功能與用法詳解
這篇文章主要介紹了JavaScript原型對象、構造函數和實例對象功能與用法,結合實例形式分析了javascript面向對象相關原型對象、構造函數及實例對象的概念、功能與相關使用技巧,需要的朋友可以參考下2018-08-08
Electron 結合 Selenium + chromedriver 
這篇文章主要介紹了Electron 結合 Selenium + chromedriver 驅動服務實現瀏覽器多開思路詳解,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友參考下吧2024-07-07
javascript 獲取元素位置的快速方法 getBoundingClientRect()
有一種快速獲得網頁元素的位置。那就是使用getBoundingClientRect()方法。2009-11-11

