难道一定要用css定义颜色?
<!DOCTYPE html> <html> <head> <title>.class选择器</title> <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script> </head> <body> <div class="red">立正,向我这边看齐</div> <div class="green">我先歇歇脚</div> </body> <script type="text/javascript"> var $redHTML = $(".red").html(); $(".green").html($redHTML); $(".red").css("color","red"); $(".green").css("color","green"); </script> </html>