close

<div id="demo"   style="overflow:hidden;height:20px;width:400px; position: absolute;
overflow:hidden;
font:12px;
display:block;
text-decoration:none;
margin:0;

 padding:0px;
text-align:left; color:#FF0000;background-color: #FFFFFF;">
<span id="demo1">
完全相容IE, FF, Opera跑馬燈語法1<br />
完全相容IE, FF, Opera跑馬燈語法2<br />
完全相容IE, FF, Opera跑馬燈語法3<br />
</span>
<span id="demo2"></span>
<span onload="M_load();" />
 </div>
 <script language="JavaScript" type="text/javascript">
<!--
var x, y, moz=(document.getElementById&&!document.all);
var MyMar;
var demoHeight;
var speed=10;
var waitspeed=1000;

if(moz){
document.addEventListener('mousemove',m_onmousemove, true);
document.addEventListener('click',m_onclick, false); 
}
else{
document.attachEvent('onmousemove',m_onmousemove );
document.attachEvent('onclick',m_onclick);
}
function m_onclick(e){
//if (document.all)e=window.event;
//document.getElementById("test").innerHTML =x+'px';
}
function m_onmousemove(e){
if (document.all)e=window.event;
ele=(document.all)?e.srcElement:e.target;
//x=(document.all)?e.offsetX:e.clientX;
//y=(document.all)?e.offsetY:e.clientY;
x=e.clientX;
y=e.clientY;
x+=(document.documentElement.scrollLeft)?document.documentElement.scrollLeft:document.body.scrollLeft;
y+=(document.documentElement.scrollTop)?document.documentElement.scrollTop:document.body.scrollTop;

//window.status='X: '+x+' Y: '+y;
//document.getElementById('test').innerHTML='X: '+x+' Y: '+y;
//document.getElementById('test').innerHTML='mouseovered Element: '+ele.tagName;
var demo=document.getElementById("demo")
demo.style.left=(x+20)+'px';
demo.style.top=(y+20)+'px';
//var test=document.getElementById("test").innerHTML =e.screenY;
}
var demo=document.getElementById("demo")
var demo1=document.getElementById("demo1")
var demo2=document.getElementById("demo2")
demoHeight=parseInt(demo.style.height)
demo1.style.lineHeight=demo.style.height
demo2.style.lineHeight=demo.style.height
demo2.innerHTML=demo1.innerHTML
MyMar=setInterval(Marquee,speed)


function Marquee(){
if(demo2.offsetTop-demo.scrollTop<=0)
{
demo.scrollTop=demo1.offsetTop
}
else{
demo.scrollTop++
if(demo.scrollTop%demoHeight==0)
waits();
}
}
function waits(){
clearInterval(MyMar)
MyMar=setTimeout(starts,waitspeed)
}
function starts(){
clearTimeout(MyMar)
MyMar=setInterval(Marquee,speed)
}
//-->
</script>
 
 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 wuminfajoy 的頭像
    wuminfajoy

    Fajoy的心情筆記

    wuminfajoy 發表在 痞客邦 留言(0) 人氣()