Rating by Jquery Rating (excellent Version)

Source: Internet
Author: User
Feature: multiple stars can be used on the same page. The number of stars is not affected by each other. You can customize the default stars. After selecting a star, you can customize the rating description for the stars. js Code: [javascript] functionInitStar (count, cur, s0, s1, ctn, txt ){... syntaxHigh: multiple stars can be used on the same page. The number of stars is not affected by each other. You can customize the default stars, you can still customize the rating description for the hovering effect. js Code: [javascript] function InitStar (count, cur, s0, s1, ctn, txt) {$ ("#" + ctn ). attr ("star", cur); for (var I = 1; I <= count; I ++) {var p = (I <= cur )? S1: s0; $ (""). addClass ("star" ).css ("cursor", "pointer "). attr ({"src": p, "flag": I }). appendTo ($ ("#" + ctn);} $ ("img. star "). mouseover (function () {var cur = parseInt ($ (this ). attr ("flag"); $ ("img. star "). each (function () {var I = parseInt ($ (this ). attr ("flag"); var p = (I <= cur )? S1: s0; $ (this ). attr ("src", p) ;}); showStar (txt, cur) ;}); $ ("img. star "). click (function () {$ ("#" + ctn ). attr ("star", $ (this ). attr ("flag") ;}; $ ("#" + ctn ). mouseout (function () {var cur = parseInt ($ (this ). attr ("star"); $ ("img. star "). each (function () {var p = ($ (this ). attr ("flag") <= cur )? S1: s0; $ (this ). attr ("src", p) ;}); showStar (txt, cur) ;});} function showStar (txt, cur) {$ ("#" + txt ). val (cur); $ ("#" + txt ). change ();} parameter description: count: Total number of stars cur: by default, the number of s0: NULL stars image path s1: the actual star image path ctn: create a Star Container txt: display the textbox Page code of the star Description: [html]
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.