手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >javascript 广告移动特效的实现代码
javascript 广告移动特效的实现代码
摘要:Document.box2{}.box2{width:200px;height:200px;background:red;border-ra...

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> .box2{} .box2{width: 200px; height: 200px; background: red; border-radius: 50%;position: relative;} .box3{width: 800px; height: 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){ lr=600; i++; } if (j>tb) { tb=0; j--; } if (j<=tb) { tb=300; j++ } stop.onclick=function(){ clearInterval(time); stop.style.display='none'; start.style.display='inline'; } },5); } </script> </html>

以上就是小编为大家带来的javascript 广告移动特效的实现代码全部内容了,希望大家多多支持查字典教程网~

【javascript 广告移动特效的实现代码】相关文章:

VBScript版代码高亮

javascript 动态添加表格行

JavaScript模版引擎的基本实现方法浅析

javascript动态设置样式style实例分析

Javascript实现飞动广告效果的方法

JavaScript中valueOf()方法的使用介绍

javaScript中push函数用法实例分析

Js和JQuery获取鼠标指针坐标的实现代码分享

javascript实现youku的视频代码自适应宽度

javascript实现Table排序的方法

精品推荐
分类导航