<! 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 = "กล่อง"> var tb = 300; var i = 0; var j = 0; var box = document.getElementById ('box'); var start = document.getElementById ('start'); var stop = document.getElementById ('หยุด'); start.onclick = function () {start.style.display = 'ไม่มี'; stop.style.display = 'inline'; var time = setInterval (function () {box.style.left = i+'px'; box.style.top = j+'px'; ถ้า (i> lr) {lr = 0; i--;} ถ้า (i <= lr) {lr = 600; i ++; TB = 300; } </script> </html>以上就是小编为大家带来的 JavaScript 广告移动特效的实现代码全部内容了, 希望大家多多支持武林网 ~