Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> <script src="http://libs.baidu.com/jquery/1.7.0/jquery.min.js"> </script> <script> $(document).ready(function(){ $("p").toggle( function(){$("p").css({"color":"red"});}, function(){$("p").css({"color":"blue"});}, function(){$("p").css({"color":"green"}); }); }); </script> </head> <body> <p style="font-size:40px">点我。</p> <div><b>注意:</b>toggle() 方法在 jQuery 版本 1.8 中被废弃,在版本 1.9 中被移除。</div> </body> </html>