<html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题页</title> <script src="jquery-1.10.2.js" type="text/javascript"></script> <script type="text/javascript"> //节点遍历 $(function(){ $('#rating td').html('☆'); // $('#rating td').mouseover(function(){ $('#rating td').html('★'); $(this).nextAll().html('☆'); }); }); </script> </head> <body> <table id="rating"> <tr><td></td><td></td><td></td><td></td><td></td></tr> </table> </body> </html>
可以把★换成图片,效果更好,但是此程序有个bug,第一个为满格后无法切换成空格