这段代码动画效果为什么实现不了

function addLoadEvent(func) {

      var oldonload = window.onload;

      if (typeof window.onload != 'function') {

         window.onload = func;

         } else {

        window.onload = function() {

           oldonload();

          func();

    }

  }

}


function positionMessage(){

  if(!document.getElementById || !document.getElementById("message")) return false;

  var elem = document.getElementById("message");

  elem.style.position = "absolute";

  elem.style.left = "50px";

  elem.style.top = "100px";

  movement = setTimeout("moveMessage()",10000);

}

function moveMessage(){

  if(!document.getElementById || !document.getElementById("message")) return false;

  var elem = document.getElementById("message");

  elem.style.left = "200px";

}

addLoadEvent(positionMessage);

addLoadEvent(moveMessage);


甫里
浏览 1406回答 1
1回答

慕郎_莲华

十秒执行一次?
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript