The function has two parameters and functions as follows:
Obj:img the parent container of the label group, the type is a DOM object;
Oevent:event object.
The advantage of this function is that the HTML code can be very concise, the use of pictures can also be very small, only need two pictures. The event handle can only be written on the parent container of the IMG. Demo use of the picture I used is an absolute address, you use the time to change to the site's relative address on it. When we clicked, I used an alert event. In fact, we'll use an Ajax method here to upload the relevant parameters to the server side. Just write alert (this._num+1) as Sendajax (this._num+1).
Two pictures needed:
<! 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> Cloud Habitat Community _www.jb51.net_" when making selected stars rating </title> <style type= "Text/css" >. starwrapper{border:1px solid #FFCC00;p adding:5px;width:70px;} . Starwrapper Img{cursor:pointer;} </style> <script type= "Text/javascript" > Function rate (obj,oevent) {//==================//Picture address settings//==== ============== var imgsrc = ' http://www.jb51.net/upload/20080508122008586.gif '; var imgsrc_2 = ' http://www.jb51.net/upload/20080508122010810.gif '; ---------------------------------------------------------------------------if (Obj.rateflag) return; var e = Oevent | | window.event; var target = E.target | | E.srcelement; var Imgarray = obj.getelementsbytagname ("img"); for (Var i=0;i <body> <p Class= "Starwrapper" onmouseover= "rate (this,event)" > </p> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]