JavaScript 高级课程之分享setInterval(),clearInterval(),onmouseover,onmouseout应用(2_自动判断正负)
来源:互联网 发布:怎么下载外国软件 编辑:程序博客网 时间:2024/05/11 18:26
<!doctype html><html><head><meta charset="utf-8"><title>JavaScript 高级课程之分享setInterval(),clearInterval(),onmouseover,onmouseout应用(2_自动判断正负)</title><style> #div1 { width:100px; height:300px; background-color:#005812; position:absolute; left:-100px;} #div2 { width:30px; height:100px; position:absolute; background-color:#CBBC5D; right:-30px; top:100px;}</style><script>window.onload = function(){ var oDiv = document.getElementById('div1'); var Timer = null; oDiv.onmouseover = function(){ fn(0); }; oDiv.onmouseout = function(){ fn(-100); }; function fn(value){ if(value < 0){ var si = -10; }else{ var si = 10; } clearInterval(Timer); Timer = setInterval(function(){ if(oDiv.offsetLeft != value){ oDiv.style.left = oDiv.offsetLeft + si +'px'; }else{ clearInterval(Timer); } },20); }}</script></head><body><div id="div1"> <div id="div2"></div></div></body></html>
0 0
- JavaScript 高级课程之分享setInterval(),clearInterval(),onmouseover,onmouseout应用(2_自动判断正负)
- JavaScript 高级课程之分享setInterval(),clearInterval(),onmouseover,onmouseout应用
- JavaScript 高级课程之定时器setInterval,clearInterval
- JavaScript----onmouseover,onmouseout 事件
- 动态菜单 javascript onmouseover onmouseout
- JavaScript中的setInterval、clearInterval用法
- JavaScript setInterval和clearInterval 定时器
- JavaScript 的 setInterval 、settimeout 、clearInterval
- CSS样式里使用JavaScript(onmouseover/onmouseout)
- CSS样式里使用JavaScript(onmouseover/onmouseout)
- CSS样式里使用JavaScript(onmouseover/onmouseout)
- CSS样式里使用JavaScript(onmouseover/onmouseout)
- CSS样式里使用JavaScript(onmouseover/onmouseout)
- JavaScript HTML DOM 事件 onchange onmouseover onmouseout
- javascript事件(onclick/onmouseover/onmouseout等)
- javascript中的setInterval和clearInterval方法
- setInterval&&clearInterval
- setInterval(),clearInterval
- Spring源码学习笔记(四)-Aop获取增强、切点
- PPT动画教程:设置“进入”动画
- 图像检索:基于内容的图像检索技术
- 在Android创建自定义View
- 最短路径
- JavaScript 高级课程之分享setInterval(),clearInterval(),onmouseover,onmouseout应用(2_自动判断正负)
- Android如何防止apk程序被反编译
- The path "C:\Oracle\Middleware\wlserver_10.3" contains the wrong version of WebLogic Server. Expect
- java FTP方式上传文件到图片服务器
- 解决eclipse debug时打开一个空心j文件
- 二维数组的声明,定义及应用
- JavaScript 高级课程之淡出淡入CSS filter等属性
- 超详细Eclipse中导入XUtils3
- apache 开机自启动脚本设置