Provides a fine jQuery code for star rating. In the past, JavaScript was used to calculate the star rating. Today we use the jquery plug-in to calculate the rating code.
<! --
Provides a fine jquery code for star rating. In the past, JavaScript was used to calculate the star rating. Today we use the jquery plug-in to calculate the rating code.
<! 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 = gbk"/>
<Title> jquery star rating effect code-download by http://www.bKjia. c0m </title>
<Script src = "images/jquery-latest.js"> </script>
<Script type = "text/Webpage effects">
$ (Function (){
$ ("Ul li"). each (function (I ){
$ (This). click (function (){
$ ("Li"). removeclass ("back ");
$ ("Li: gt (" + I + ")"). addclass ("back ");
})
})
});
</Script>
<Style type = "text/css tutorial">
. Front {
Background: url (images/star_03.jpg );
}
. Back {
Background: url (images/star_hover.jpg );
}
Ul {
List-style: none;
Width: 300px;
}
Ul li {
Display: block;
Float: left;
Border: 1px solid # ccc;
Width: 31px;
Height: 30px;
Background: url (images/star_03.jpg );
Margin: 0px 5px 0px;
}
</Style>
</Head>
<Body>
<Ul>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
</Ul>
</Body>
</Html>
Effect preview address
Http://g.111cn.cn/javascript/js/20100830/jquery%20
Instance
Http://down.bKjia. c0m/down/code/jquery/2010/0830/20530.html