<!--var interval_id// These variables determine how far the window moves in each interval
var delta_x = 10
var delta_y = 10// These variables determine the screen's right and bottom edges
var x_maximum = screen.availWidth
var y_maximum = screen.availHeight - 20// These variables set the starting position 
// of the window's right edge and bottom edge
var x_position = 100
var y_position = 100// Start the interval
interval_id = setInterval("move_window()", 50)// Use this function to cancel the interval when the page is unloaded
function end_interval() {
    clearInterval(interval_id)
}function move_window() {
    
    // Move the window
    moveBy(delta_x, delta_y)
    
    // Update the position of the right and bottom edges
    x_position += delta_x
    y_position += delta_y
    
    // See if the window has hit the right edge (x_maximum)
    // or the left edge (x_position - 100) of the screen
    if (x_position >= x_maximum || x_position <= 100) {
    
        // If so, negate the delta_x value to
        // change the horizontal direction
        delta_x = -delta_x
    }    // See if the window has hit the bottom edge (y_maximum)
    // or the top edge (y_position - 100) of the screen
    if (y_position >= y_maximum || y_position <= 100) {
    
        // If so, negate the delta_y value to
        // change the vertical direction 
        delta_y = -delta_y
    }
}//-->

解决方案 »

  1.   

    最后再请教一下 
      为什么它要使用js脚本来移动而不是使用<marquee>滚动标签呢?
    这样做有什么好处?谢谢·~~
      

  2.   

    <body>
    <div id=c style="left:10;border:1px solid black;height:0px;padding:20px;font-size:10.2pt"></div>
    <script>
    <!--
    function fI()
    {
    var h=parseInt(c.style.height);
    if(h>500)
    {
    clearTimeout(_t);c.innerHTML='welcome to csdn'
    }
    else
    {
    c.style.height=h+10+'px';
    }
    _t=setTimeout(fI,10);
    }
    fI()
    </script>
    </body>
      

  3.   

    <body>
    <style>
    .div
    {
    border:1px solid black;height:10px;padding:20px;font-size:10.2pt;margin:20
    }
    </style>
    <div id=c>
    <div id=c1 class="div">c1</div>
    <div id=c2 class="div">c2</div>
    </div>
    <button onclick="fInsert()">insert</button>
    <script>function fInsert()
    {
    if(document.getElementById("c3"))return;
    var c3=document.createElement("div")
    c3.innerHTML="c3 <a href='javascript:void(fRemove())'>remove</a>";
    c3.id='c3';
    c3.className="div";
    c.insertBefore(c3,c2)
    }
    function fRemove()
    {
    c3.parentNode.removeChild(c3)
    }
    </script>
    </body>