jquery实现上下浮动:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function() { $("button").click(function(){ a(); }); }); <!--递归循环--> function a(){ $("#p1").css("color","red").slideUp(2000).slideDown(2000,function(){ a(); }); } </script> </head> <body> <p id="p1">菜鸟教程!!</p> <button>点我</button> </body> </html>