浙ICP备11019884号-1  

七星彩,特区七星彩论坛,七星彩有限公司

var demo = document.getElementById('demo'); var sx = sy = 1; var x = y = 300; function move(){ if(document.documentElement.clientWidth - demo.offsetWidth-1 < x || x < 0){ sx = -sx; } if(document.documentElement.clientHeight - demo.offsetHeight-1 < y || y < 0){ sy = -sy; } x = demo.offsetLeft + sx; y = demo.offsetTop + sy; demo.style.left = x + 'px'; demo.style.top = y + 'px'; } var timer = setInterval(move, 40); demo.onmouseover = function(){ clearInterval(timer); } demo.onmouseout = function(){ timer = setInterval(move, 40); }