<html><head> <title>動(dòng)畫效果</title> <meta charset="utf-8" /><style>body,div,span{ margin: 0; padding: 0;} #div1{ background-color:red; width: 200px; height: 200px; border-radius: 15px; border: 2px purple solid; top:0; position: relative; left: -200px; } #div1 span{ background-color: palevioletred; width: 20px; height: 50px; ?left:200px; ?top: 70px; border: 2px white solid; position: absolute; }</style><script>window.onload = function(){ var oDIV = document.getElementById('div1'); oDIV.startMouseover = function(){ startMove(); }}function startMove(){ var oDIV = document.getElementById('div1'); setInterval(function(){ oDIV.style.left = oDIV.offsetLeft + 10 + 'px'; },30) }</script></head><body><div id="div1"><span id="share">點(diǎn)擊</span></div></body></html>為什么上面代碼,不會(huì)出現(xiàn)動(dòng)畫效果呢,鼠標(biāo)移上去沒有動(dòng)畫效果出現(xiàn),可是沒發(fā)現(xiàn)代碼有什么錯(cuò)誤
2-1 js速度動(dòng)畫
慕斯2134027
2016-11-26 14:40:22