Need to add a star rating to website
Can you tell me if there's a Star Rating I can use built into your tools?
I saw a forum from Webassist with someone asking the same, but it's from 2009. Anything for 2019?
Appreciate your advise.
Can you tell me if there's a Star Rating I can use built into your tools?
I saw a forum from Webassist with someone asking the same, but it's from 2009. Anything for 2019?
Appreciate your advise.
We don't have anything for that. It is essentially a custom form element that submits numbers 1-5 based on star clicks. We don't have anything like that, but a google search should turn something up you can use.
I had downloaded a set of code to do just that before I contacted you and it had php issues. I then used the snippet of code you posted 10 yrs. ago, I used the hidden field to insert into the db, changed the one big star image to a 5 star image and just made sure the type in the table was set to decimal with 1 digit after decimal. It works great still:
Here's the code you had suggested if anyone cares to use it. It was simple and works for what I needed it - a simple form:
<script>
freeze = 0;
hasRated = false;
function point_it(event,freezeit){
pos_x = event.offsetX?(event.offsetX):event.pageX-document.getElementById("rating_image").offsetLeft;
pos_x = Math.round(pos_x/14)*14;
document.getElementById('rating_gradient').style.width = pos_x+"px";
if (freezeit) {
hasRated = true;
freeze = pos_x;
document.getElementById('hiddenRating').value = pos_x/28;
document.getElementById('RatingText').innerHTML = 'Current rating: <str' +'ong>'+(pos_x / 28)+'<\/strong>\/ 5';
}
}
function returntofreeze(){
document.getElementById('rating_gradient').style.width = freeze+"px";
}
</script>
How would you rate this?
<br />
<div id="rating_image" style="position:absolute"><img src="http://www.webassist.com/images/star_cutout.gif" width="140" height="28" alt="rating" onmousemove="point_it(event)" onclick="point_it(event,true)" onmouseout="returntofreeze()"/></div>
<div id="rating_gradient" style="width:0px;overflow:hidden;display:block;"><img src="http://www.webassist.com/images/star_gradient.jpg" width="140" height="28" /></div>
<input name="hiddenRating" type="hidden" id="hiddenRating" value="0" />
<div id="RatingText">Current rating: <strong>0</strong>/5</div>
This forum is a treasure trove ;)
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.