Rating Script With YUI

I found a star rating script that was built with the YUI library but it didn't quite suite the needs of the page I was incorporating it into. So I decided to remove the requirement of a single element on the page allowing the ratings to be used as many times on a single page as is required. I have also added some extra functionality and options. All of the script and CSS is in the source of this page. View the blog

With a <div>

Example rating:

This will be replaced!

Without JavaScript

This will be replaced!

The Markup

<div class="ratingdiv no-form">
	<div class="rating-el" title="Average: 4.5">This will «
	be replaced!</div>
</div>
						

With an anchor

Example rating:


Without JavaScript

This will be replaced

The Markup

<div class="ratingdiv no-form">
	<a href="#n" title="Average: 3.1" class="rating-el">This «
	will be replaced</a>
</div>
						

With a form

Example rating:


Without JavaScript


The Markup

<form action="" method="post" title="Average: 2.8">
	<fieldset>
		<label for="id_rating">Rating:</label>
		<select name="rating" id="id_rating">
			<option value="1">1 - Poor</option>
			<option value="2">2 - Fair</option>
			<option value="3">3 - Good</option>
			<option value="4">4 - Very Good</option>
			<option value="5">5 - Excellent</option>
		</select>
		<input type="submit" value="Submit rating" «
		name="submitRating" />
	</fieldset>
</form>