close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Need to add a star rating to website

Thread began 10/23/2019 9:06 am by lr_leal239405 | Last modified 10/24/2019 9:41 am by lr_leal239405 | 780 views | 3 replies

lr_leal239405

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>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

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.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...