<! Doctype html> <html lang = "en"> <head> <meta charset = "utf-8"> <title> документ </title> <style> .box2 {} .box2 {width: 200px; Высота: 200px; Фон: красный; граница-радий: 50%; позиция: относительно;} .box3 {ширина: 800px; Высота: 500px; Граница: 1px Solid Red;} </style> </head> <body> <button type = "" id = "start"> 开始 </button> <button type = "" id = "stop"> 停止 </button> <div> <div id = "box"> </div> </div> </body> <script type = "text/javascript"> var = 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 = 'none'; 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; TB = 300; } </script> </html>以上就是小编为大家带来的 Javascript 广告移动特效的实现代码全部内容了 , ~