用js写,球不动。在var marginLeft = parseInt(ball.style.marginLeft,10); 上面可能要加下面一行:
ball.style.marginLeft = ball.style.marginLeft + 0;
ball.style.marginLeft = ball.style.marginLeft + 0;
2017-08-07
刚才是.ball1.style.marginLeft JS的坑找的我头脑都不清楚了 Orz......
2017-08-07
再补充一点 offsetLeft是无法对其进行赋值的,所以要改变ball1的左边距必须要用.ball1.style.left
2017-08-07