Register

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
    Posts
    76
    Member #
    15335
    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?

  2.  

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

    CRV Designs
    Apex, NC
    www.crv-designs.com

  4. #3
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    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: http://www.webdesignforums.net/showthread.php?t=6180

    Here is the post with the final script ready for install: http://www.webdesignforums.net/showp...9&postcount=74

    Here is an example of the script in use: http://www.uselise.com/lotus_dealerships.php

  5. #4
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    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
    Posts
    36
    Member #
    15868
    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
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    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 12:14 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com