I need star rating. In page value are comming from Java/Backend.(I need only javascript or prototypejs solution.)
Eg: If value come 1 then it must show 1 STAR.
If value come 2 then it must show 2 STAR and so on...till 5
This whole thing is happening in dynamic . I am using below code, but this does not create ID.
Javascript
function display() {
var x = "yr";
show_image(x ,2) ;
}
function show_image (id,number) {
var x = number;
var y = id;
for (var i =0; i<x; i++){
var img = document.createElement("img");
img.src = "stars.png";
document.getElementById(y).appendChild(img);
}
}
Thanks for help.