javascript简单的动画效果
2009-07-28 08:32
330 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <mce:style><!-- .box{border:#C90 1px solid;width:200px;height:20px; margin:0 auto; position:relative;} .movebox{width:20px;height:20px; background:#9C0; overflow:hidden; position:absolute;left:0} --></mce:style><style mce_bogus="1">.box{border:#C90 1px solid;width:200px;height:20px; margin:0 auto; position:relative;} .movebox{width:20px;height:20px; background:#9C0; overflow:hidden; position:absolute;left:0}</style> </head> <body onload="moves()"> <div class="box" id="box"> <div class="movebox" id="movebox"></div> </div> <mce:script type="text/javascript"><!-- var $ = function(id){ return document.getElementById(id)} $("movebox").style.position = 'absolute'; $("movebox").style.left = 0; function moves(){ var ypos = parseInt($("movebox").style.left) ; if(ypos < 180){ ypos++; } $("movebox").style.left = ypos + 'px'; setTimeout(moves,10); } // --></mce:script> </body> </html>
代码写的不好,有看的朋友欢迎指出问题,谢谢
相关文章推荐
- 原生javascript实现的一个简单动画效果
- Javascript学习------top/left简单动画,效果与jquery的动画差不多
- 利用javascript实现简单动画效果。
- JavaScript-html标题滚动效果的简单实现
- 简单的动画效果 iOS新手笔记
- JavaScript DOM中 改变样式属性,实现动画效果
- JavaScript DOM中 改变样式属性,实现动画效果 2
- JavaScript DOM中 改变样式属性,实现动画效果 2
- Mono For Android中简单实现按钮的动画效果
- 使用javascript实现简单的选项卡切换效果
- iOS添加到购物车的简单动画效果
- IT忍者神龟之Photoshop简单几步制作秋意GIF动画效果
- 二、JavaScript语言--JS动画--JS动画效果
- javaScript简单动画
- javascript转换静态图片,增加粒子动画效果
- javascript转换静态图片,增加粒子动画效果
- 使用JavaScript和Canvas实现下雪动画效果
- 使用NSTimer与iphone的简单动画,实现飘雪效果
- css动画效果简单zol
- iOS(学习) 一个简单的动画效果