If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Member metromax's Avatar
    Join Date
    Jun 2007
    Member #
    does anyone know how to create a 5-star rating script using javascript. I've seen it done quite a few times and it seems pointless to me to create a database for that sort of thing and use PHP. Can anyone help?


  3. #2
    Senior Member beachkitty85's Avatar
    Join Date
    Feb 2007
    Apex, NC
    Member #
    This is just me thinking, but how would you store the ratings without a database?
    Christina Van Dyke

    CRV Designs
    Apex, NC

  4. #3
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Boston, MA
    Member #
    205 times
    You can create a 5-star input with javascript, but without a database or other storage system, the inputs will all be sent to oblivion...

    Here's a 5-star rating system we designed here at WDF:

    Here is the post with the final script ready for install:

    Here is an example of the script in use:

  5. #4
    Senior Member
    Join Date
    Jun 2005
    Atlanta, GA
    Member #
    1 times
    Though if I were to write this today, I'd probably do it somewhat differently, I wrote a 5-star rating system a couple of years ago that takes a regular 5-radio-button-inputs system and turns it into a 5-star-image system with options for halves (i.e., 0.5, 1.5, etc) dynamically (i.e., it degrades gracefully).

    Basically, if you create a div with id `rating', it'll apply itself to it. The name of the hidden form field that will get the actual value of the rating will be [minicode]review[rating][/minicode] (due to the context in which I was using it). I'd also recommend you slip a set of 5-10 radio buttons in there, so that when Javascript is not enabled the user will have radio buttons, at least.

    I've attached the script and associated images. Look at the script to determine the path of the images (typically, they should be at [minicode]/images/star.png[/minicode], etc).

    Like I said, if I were to rewrite this today, I'd probably do some things differently (I'd probably use Prototype, for one), but this script was just lying around and it's not too horrible.

    EDIT: I should also point out that I don't know what good ratings would do you without a database backing them

  6. #5
    Member Bulletz's Avatar
    Join Date
    Sep 2007
    Member #
    Quote Originally Posted by beachkitty85
    This is just me thinking, but how would you store the ratings without a database?
    Could always just store the ratings data in a simple flat file if you aren't expecting alot of traffic... although if you have it available to you I'd suggest just creating a simple sql database, it'll be a whole lot more efficient and versatile.

  7. #6
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Bandung, Indonesia
    Member #
    I think he doesn't even want to use PHP, and just wants to use HTML/JS.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 02:45 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: