URL: scantodefend.com/muller008/testimonials.html
Acesta este codul javascript:
Cod: Selectaţi tot
var sMax;
var holder;
var preSet;
var rated;
function rating(num){
sMax = 0;
for(n=0; n<num.parentNode.childNodes.length; n++){
if(num.parentNode.childNodes[n].nodeName == "A"){
sMax++;
}
}
if(!rated){
s = num.id.replace("_", ''); // Get the selected star
a = 0;
for(i=1; i<=sMax; i++){
if(i<=s){
document.getElementsByClassName("_"+i).className = "on";
document.getElementsByClassName("rateStatus").innerHTML = num.title;
holder = a+1;
a++;
}else{
document.getElementsByClassName("_"+i).className = "";
}
}
}
}
function off(me){
if(!rated){
if(!preSet){
for(i=1; i<=sMax; i++){
document.getElementsByClassName("_"+i).className = "";
document.getElementsByClassName("rateStatus").innerHTML = me.parentNode.title;
}
}else{
rating(preSet);
document.getElementsByClassName("rateStatus").innerHTML = document.getElementsByClassName("ratingSaved").innerHTML;
}
}
}
function rateIt(me){
if(!rated){
document.getElementsByClassName("rateStatus").innerHTML = document.getElementsByClassName("ratingSaved").innerHTML + me.title;
preSet = me;
rated=1;
rating(me);
}
}
Cod: Selectaţi tot
<span class="rateStatus"></span>
<span class="ratingSaved"></span>
<div class="rateMe">
<a onclick="rateIt(this)" class="_1" onmouseover="rating(this)" onmouseout="off(this)"></a>
<a onclick="rateIt(this)" class="_2" onmouseover="rating(this)" onmouseout="off(this)"></a>
<a onclick="rateIt(this)" class="_3" onmouseover="rating(this)" onmouseout="off(this)"></a>
<a onclick="rateIt(this)" class="_4" onmouseover="rating(this)" onmouseout="off(this)"></a>
<a onclick="rateIt(this)" class="_5" onmouseover="rating(this)" onmouseout="off(this)"></a>
</div>