<BODY ID="bodyid" 给BODY命名一个IDonload="LoadDone()"  页面加载后执行LoadDone()onresize ="End();LoadDone();"  页面大小发生变化,比如最大化,拖动改变大小等时候执行End();LoadDone();onunload="End()">  页面转向、刷新或者关闭的时候执行End()

解决方案 »

  1.   

    要看你的函数如何实现的..
    这几句看不出名堂来..
    大体上只是把onresize当做一次reload事件处理
      

  2.   

    <HEAD>
    <SCRIPT>
    var timid = -1;
    var timoID_2 = -1;
    var nLine;
    var nPosInLine;
    var oRcts;
    var nDivLen;
    var nEraser;function LoadDone() {
        oTextRange = document.body.createTextRange();              
        // Get bounding rect of the range
        oRcts = oTextRange.getClientRects();
        nLine = 0;
        oBndRct = obj.getBoundingClientRect();
        nDivLen = oBndRct.right - oBndRct.left + 1;    
        MoveTo();
    }function MoveTo() {
        if (nLine >= oRcts.length) {
        nLine = 0;
    }
        obj.style.top = oRcts[nLine].top;
        nPosInLine = oRcts[nLine].left;
        nEraser = 0;
        timoID_2 = setInterval("MoveToInLine()",60);    
    }function MoveToInLine() {
        if (nPosInLine >= oRcts[nLine].right - nDivLen) {
            clearInterval(timoID_2);
            timoID_2 = -1;
            obj.style.left = oRcts[nLine].right - nDivLen;
            nLine++;
            timid = setTimeout("MoveTo()", 100);
            return;
        }
        if (nEraser == 0) {
        nEraser = 1;
    }
        else {
        nEraser = 0;
    }
    im.src = "http://www.csdn.net/images/csdn.gif";
        obj.style.left = nPosInLine;
        nPosInLine += 3;
    }function End() {
        if(timid != -1) {
        clearInterval(timid);
            timid = -1;
    }
        if(timoID_2 != -1) {
        clearInterval(timoID_2);
            timoID_2 = -1;
    }
    }
    </SCRIPT>
    </HEAD><BODY ID="bodyid" onload="LoadDone()"  onresize ="End();LoadDone();" onunload="End()"><P STYLE="text-align:center">
    <B>The quick brown fox jumps over the lazy dog.</B>
    </P><DIV ID="obj" STYLE="position:absolute">
    <IMG ID="im" SRC="http://www.csdn.net/images/csdn.gif"
        BORDER=0 HEIGHT=80 WIDTH=100>
    </DIV></BODY>