<! Doctype html> <html lang = "en"> <éadf> <meta charset = "utf-8"> <tight> Document </Title> <style> .box2 {} .box2 {width: 200px; hauteur: 200px; Contexte: rouge; Border-Radius: 50%; position: relative;} .box3 {largeur: 800px; hauteur: 500px; Border: 1px Solid Red;} </ style> </ head> <body> <Button type = "" id = "start"> 开始 </ Button> <Button Type = "" id = "stop"> 停止 </ Button> <v> <div id = "box"> </div> </div> </ body> <script type = "text / javascript"> var lr = 600; var TB = 300; var i = 0; var j = 0; var box = document.getElementById ('box'); var start = document.getElementById ('start'); var stop = document.getElementById ('stop'); start.onclick = function () {start.style.display = 'Aucun'; stop.style.display = 'inline'; var time = setInterval (function () {box.style.left = i + 'px'; box.style.top = j + 'px'; if (i> lr) {lr = 0; i--;} if (i <= lr) {lr = 600; i ++;} if (j> tb) {tb = 0; j--;} tb = 300; j ++} stop.onclick = function () {clearInterVal (temps); } </ script> </html>以上就是小编为大家带来的 javascript 广告移动特效的实现代码全部内容了 , 希望大家多多支持武林网 ~