向左滾動文字 js代碼效果
<html>
<head>
<title>滾動文字效果</title>
<style type="text/css">
#infozone{font-size:12px;color:#aa6;overflow:hidden;width:100px;height:20px;}
#infozone div{height:20px;line-height:20px;white-space:nowrap;overflow:hidden;}
</style>
<script type="text/javascript">
var tc;
window.onload=function(){
var o=document.getElementById('infozone');hscroll(o);
window.setInterval(function(){window.clearTimeout(tc);o.firstChild.style.marginLeft='0px';scrollup(o,20,0);},10000);
}
function scrollup(o,d,c){
if(d==c){
var t=o.firstChild.cloneNode(true);
o.removeChild(o.firstChild);o.appendChild(t);
t.style.marginTop=o.firstChild.style.marginTop='0px';
hscroll(o);
}
else{
ch=false;var s=3,c=c+s,l=(c>=d?c-d:0);
o.firstChild.style.marginTop=-c+l+'px';
window.setTimeout(function(){scrollup(o,d,c-l)},50);
}
}
function hscroll(o){
var w1=o.firstChild.offsetWidth,w2=o.offsetWidth;
if(w1<=w2)return;
tc=window.setTimeout(function(){hs(o,w1-w2,0,w1-w2)},3500);
}
function hs(o,d,c,p){
c++;var t=(c>0?-c:c);o.firstChild.style.marginLeft=t+'px';
if(c==d){if(d==0){tc=window.setTimeout(function(){hs(o,p,0,p)},2500);}else tc=window.setTimeout(function(){hs(o,0,-p,p)},3500);}
else tc=window.setTimeout(function(){hs(o,d,c,p)},5);
}
</script>
</head>
<body>
<div id="infozone"><div>C# 鼠標屬性動態(tài)操作相關源碼示例,比如、隱藏與顯示鼠標指針、將鼠標左右鍵功能互換、更換鼠標指針形狀、調用Windows鼠標設置面板等,小技巧,多多益善。</div></div>
</body>
</html></td>
</tr>
</table>
相關文章
javascript實現(xiàn)input file上傳圖片預覽效果
這篇文章主要介紹了javascript實現(xiàn)input file上傳圖片預覽效果,感興趣的小伙伴們可以參考一下2015-12-12
JavaScript實現(xiàn)點擊出現(xiàn)圖片并統(tǒng)計點擊次數(shù)功能示例
這篇文章主要介紹了JavaScript實現(xiàn)點擊出現(xiàn)圖片并統(tǒng)計點擊次數(shù)功能,涉及javascript事件響應及頁面元素屬性動態(tài)操作相關實現(xiàn)技巧,需要的朋友可以參考下2018-07-07
JavaScript數(shù)組中reduce方法的應用詳解
JavaScript 中的reduce()方法可以用于將數(shù)組元素匯總為單個值,,所以本文為大家整理了一些JavaScript數(shù)組中reduce方法的應用,需要的可以參考一下2023-07-07

