76、一个不停移动的小圆点

76、一个不停移动的小圆点

<body onselectstart="return false">

<script>

var curRects,moveStep,curLine,ballLen,moveTime

 

 

function startMove()

{

       curRects = document.body.createTextRange().getClientRects()

      

       var TempRect = ball.getBoundingClientRect()

      

       ballLen = TempRect.right - TempRect.left

      

       curLine = 0

       moveStep = 0

      

       clearTimeout(moveTime)

      

       moveBall()

}

 

window.onload = startMove

window.onresize = startMove

 

var isStop = false

 

function document.onclick()

{

       if(document.readyState == "complete")

       {

              isStop = !isStop

             

              if(isStop)

                     clearTimeout(moveTime)

              else

                     moveTime = setTimeout("moveBallInLine()",50)                           

       }

}

 

function moveBall()

{

       if(curLine == curRects.length)

              curLine = 0

      

       moveStep = 0

      

 

       with(ball.style)

       {

              top = curRects[curLine].top

              left = curRects[curLine].left

       }    

 

      

       moveTime = setTimeout("moveBallInLine()",50)      

}

 

function moveBallInLine()

{

       moveStep += 5

 

       if(moveStep < curRects[curLine].right - curRects[curLine].left - ballLen)

       {

              ball.style.left = moveStep + curRects[curLine].left            

             

              moveTime = setTimeout("moveBallInLine()",50)

       }

       else

       {

              ball.style.left = curRects[curLine].right - curRects[curLine].left - ballLen

             

              curLine ++

             

              moveBall()

       }

}

</script>

<p>中新网北京826消息:美国常务副国务卿阿米蒂奇抵达北京,准备与中方人员讨论中美领袖10月举行高峰会议等事宜。</p>

<p>外电报道说,阿米蒂奇星期一预计会和中国官员讨论一系列双边和国际课题,其中包括为中国国家主席江泽民在10月访问美国作好准备工作。

</p>

<p>88,中国外交部发言人孔泉就美国常务副国务卿阿米蒂奇访华事回答记者提问时说,经中美双方商定,美国常务副国务卿里查德·阿米蒂奇将于82527日访问中国,与李肇星副外长举行政治磋商。届时双方将就中美关系和共同关心的重大国际及地区问题交换看法。</p>

<div id="ball" style="position: absolute; top: 162; left: 12; width: 6; height: 16">

 

</div>

 

Write a comment

Comments: 0