The function has two parameters:
Obj: the parent container of the img label group. Its type is DOM object;
OEvent: event object.
The advantage of this function is that the html code can be very concise, and there can be very few images, only two images are required. The event handle must be written in the parent container of img. The image used for the demonstration is an absolute address. You can change it to the relative address of the website when using it. When we click, I use an alert event. In fact, we will use an ajax method to upload relevant parameters to the server. You just need to write alert (this. _ num + 1) as sendAjax (this. _ num + 1.
Two images are required:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml"> <pead> <meta http-equiv =" content-Type "content =" text/html; charset = UTF-8 "/> <title> script house _ www.jb51.net _ select a star for scoring </title> <style type =" text/css ">. starWrapper {border: 1px solid # FFCC00; padding: 5px; width: 70px ;}. starWrapper img {cursor: pointer ;}</style> <body> <p class = "starWrapper" onmouseover = "rate (this, event) "> </p> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]