<! doctype html> <html lang =“ en”> <head> <head> <meta charset =“ utf-8”> <title> </title> </title> </title> <box2 {} .box2 {width:width:200px;身高:200px;背景:紅色;邊界 - 拉迪烏斯:50%;位置:相對;} .box3 {width:800px;身高:500px; border: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 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 ='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)if(i <= lr) tb = 300; j ++} stop.onclick =函數() } </script> </html>以上就是小編為大家帶來的javaScript廣告移動特效的實現代碼全部內容了,希望大家多多支持武林網〜