Tip: you can modify some code before running
<script language="javascript">/* Class that defines a standard ratings component. * // Messages for display abve the individual ratings units. the length of the // array also defines how many units to include in the component. yg_Ratings.Msgs = new Array ("poor", "pass", "average", "better", "great"); yg_Ratings.Labels = new Array ("1 Star ", "2 Stars", "3 Stars", "4 Stars", "5 Stars"); // Path for all images. // var path = "http://us.i1.yimg.com/us.yimg.com/ I /us/ls/gr/"; // var path = "http://us.i1.yimg.com/us.yimg.com/ I /us/sh/karma/yri_"; var path = "http://www.dphost.cn/images/yri_"; yg_Ratings.starbar = "star _"; // Image for set units. yg_Ratings.UnitY = "yellow.gif"; // Image for set units <= the mouse over point. yg_Ratings.UnitYMouseOver = "yellow.gif"; // Image for set units> the mouse over point. yg_Ratings.UnitYMouseLess = "grey.gif"; // Image for unset units. yg_Ratings.UnitN = "white.gif"; // Image for unset units <= the mouse over point. yg_Ratings.UnitNMouseOver = "hover.gif"; yg_Ratings.DefaultMsg = ""; function yg_Ratings (id, button, inputname, defaultval, type) {// The id parameter is the name (a string) of the variable to which the // instance is assigned. (The variable is sent along to event handlers, // so it must be in the global scope .) var I, t; var attributes; var h1, h2; var d = document; var style; this. starbar = type + "_"; this. rating = 0; this. showbutton = button; if (defaultval <1 | defaultval> 5) {defaultval = 0;} this. rating = defaultval; attributes = 'class = "ygrtngs" id = "'+ id +'" style = "'+ style + '"'; h1 = 'onmouseout = "return yg_Ratings_mouseOut ('+ id +');" '; d. write (''); if (defaultval> 0 & type =" star ") {d. write ('<div class="msg" id="'+id+'_msg">'+ Yg_ratings.ms [defaultval-1] +'</div>');} Else {d. write ('<div class="msg" id="'+id+'_msg" style=\"display:none\">'+ Yg_Ratings.DefaultMsg +'</div>');} If (this. showbutton) {d. write ('<strong>Rate it:</strong>') ;}For (I = 1; I <= yg_Ratings.Msgs.length; I ++) {h1 = 'onmouseover = "return yg_Ratings_mouseOver (' + id + ', '+ I +'); "'; h2 = 'onclick =" return yg_Ratings_click (' + id + ',' + I + '); "'; d. write (''); if (I <= defaultval) {d. write ('');} else {d. write ('');} d. write ('');} if (defaultval) {d. write ('<input type="hidden" name="'+inputname+'" id="input_'+id+'" value="' + defaultval + '" />');} Else {d. write ('<input type="hidden" name="'+inputname+'" id="input_'+id+'" />');} This. input = document. getElementById ('input _ '+ id); d. write (''); this. parent = document. getElementById (id); this. images = this. parent. getElementsByTagName ("img"); this. msg = document. getElementById (id + '_ msg'); this. id = id; var children = this. msg. childNodes; var node; for (var I = 0; I <children. length; I ++) {node = children [I]; if (node. nodeType = 3) {this. defaultMsg = node. nodeValue; }}} Function yg_Ratings_set (n, oflag) {if (arguments. length <2) oflag = true; this. rating = n; this. defaultMsg = yg_Ratings.Msgs [n-1]; // if (this. showbutton) {this. showBtn ("btnSave"); //} this. update (n, oflag);} function yls_Ratings_showSubmit (sBtn) {var saveButton = document. getElementById (sBtn); if (saveButton! = Null) {saveButton. style. display = "block" ;}} function yg_Ratings_setMsg (m) {var children = this. msg. childNodes; var node; for (var I = 0; I <children. length; I ++) {node = children [I]; if (node. nodeType = 3) {// Using 0xA0 prevents the browser from collapsing empty messages. node. nodeValue = m ;}} function yg_Ratings_get () {return this. rating;} function yg_Ratings_update (n, oflag) {// The oflag parameter is true when the mouse is outside of the ratings // component. the n parameter is the if (this. starbar = 'Star _ ') {if (oflag) {this. setMsg (this. defaultMsg);} else {this. setMsg (yg_Ratings.Msgs [n-1]) ;}} if (n = this. rating) {this. input. setAttribute ("value", n) ;}for (I = 1; I <= yg_Ratings.Msgs.length; I ++) {if (oflag) {if (I <= this. rating) this. images [I-1]. src = path + this. starbar + yg_Ratings.UnitY; else this. images [I-1]. src = path + this. starbar + yg_Ratings.UnitN;} else {if (I <= n) {if (I <= this. rating) this. images [I-1]. src = path + this. starbar + yg_Ratings.UnitYMouseOver; else this. images [I-1]. src = path + this. starbar + yg_Ratings.UnitNMouseOver;} else {if (I <= this. rating) this. images [I-1]. src = path + this. starbar + yg_Ratings.UnitYMouseLess; else this. images [I-1]. src = path + this. starbar + yg_Ratings.UnitN ;}} return true;} function yg_Ratings_click (obj, n) {obj. set (n, false); return true;} function yg_Ratings_mouseOver (obj, n) {obj. update (n, false); return true;} function yg_Ratings_mouseOut (obj) {obj. update (0, true); return true;} bandwidth = yg_Ratings_set; bandwidth = yg_Ratings_setMsg; bandwidth = yg_Ratings_get; yg_Ratings.prototype.update = yg_Ratings_update; bandwidth = yls_Ratings_showSubmit;</script>Access speed:<script>if (document.getElementById){// Support for Class A._ratings_proj1_ = new yg_Ratings("_ratings_proj1_", false, "proj1", 0, "star");}else{// Support for poor DOM (low grade).document.write('<small><input type=radio name="proj1" value="1">');document.write('<input type=radio name="proj1" value="2">');document.write('<input type=radio name="proj1" value="3">');document.write('<input type=radio name="proj1" value="4">');document.write('<input type=radio name="proj1" value="5"></small>');}</script><noscript><small><input type=radio name="proj1" value="1"><input type=radio name="proj1" value="2"><input type=radio name="proj1" value="3"><input type=radio name="proj1" value="4"><input type=radio name="proj1" value="5"></small></noscript>Cost effectiveness:<script>if (document.getElementById){// Support for Class A._ratings_proj2_ = new yg_Ratings("_ratings_proj2_", false, "proj2", 0, "star");}else{// Support for poor DOM (low grade).document.write('<small><input type=radio name="proj2" value="1">');document.write('<input type=radio name="proj2" value="2">');document.write('<input type=radio name="proj2" value="3">');document.write('<input type=radio name="proj2" value="4">');document.write('<input type=radio name="proj2" value="5"></small>');}</script><noscript><small><input type=radio name="proj2" value="1"><input type=radio name="proj2" value="2"><input type=radio name="proj2" value="3"><input type=radio name="proj2" value="4"><input type=radio name="proj2" value="5"></small></noscript></td></tr><tr><td>Service quality:</td><td><script>if (document.getElementById){// Support for Class A._ratings_proj3_ = new yg_Ratings("_ratings_proj3_", false, "proj3", 0, "star");}else{// Support for poor DOM (low grade).document.write('<small><input type=radio name="proj3" value="1">');document.write('<input type=radio name="proj3" value="2">');document.write('<input type=radio name="proj3" value="3">');document.write('<input type=radio name="proj3" value="4">');document.write('<input type=radio name="proj3" value="5"></small>');}</script><noscript><small><input type=radio name="proj3" value="1"><input type=radio name="proj3" value="2"><input type=radio name="proj3" value="3"><input type=radio name="proj3" value="4"><input type=radio name="proj3" value="5"></small></noscript></td><td>Security:</td><td><script>if (document.getElementById){// Support for Class A._ratings_proj4_ = new yg_Ratings("_ratings_proj4_", false, "proj4", 0, "star");}else{// Support for poor DOM (low grade).document.write('<small><input type=radio name="proj4" value="1">');document.write('<input type=radio name="proj4" value="2">');document.write('<input type=radio name="proj4" value="3">');document.write('<input type=radio name="proj4" value="4">');document.write('<input type=radio name="proj4" value="5"></small>');}</script><noscript><small><input type=radio name="proj4" value="1"><input type=radio name="proj4" value="2"><input type=radio name="proj4" value="3"><input type=radio name="proj4" value="4"><input type=radio name="proj4" value="5"></small></noscript>
Tip: you can modify some code before running