Login   Register  
PHP Classes

File: javascript.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of akash  >  Star rating package  >  javascript.php  >  Download  
File: javascript.php
Role: Auxiliary script
Content type: text/plain
Description: includes javascript to the code and downloads the images required
Class: Star rating package
Process and show rating stars given by the user
Author: By
Last change:
Date: 6 years ago
Size: 1,233 bytes


Class file image Download
<script language="javascript">
var ratingImageDir = '<?php print RATING_IMAGES_DIR?>';

function highlightRatingStar(item, value) {
    //    Replaces the star image when selected. 
    for(var y=1; y <= value; y++) {
        document.getElementById('image_' + item + '_' + y).src = ratingImageDir + "/star3.gif";

function normalRatingStar(item, value) {
    //    Replaces the star image when unselected.
    for(var y=1; y <= value; y++)    {
        document.getElementById('image_' + item + '_' + y).src = ratingImageDir + "/star1.gif";

function setItemRating(item, value) {
    document.getElementById('itemId').value = item;
    document.getElementById('rating').value = value;
<div style="display: none; width: 0px; height: 0px;">
<img src="<?php print RATING_IMAGES_DIR?>/star3.gif">
<img src="<?php print RATING_IMAGES_DIR?>/star2.gif">

<form name="itemRatingForm" method="post" action="set-item-rating.php" target="setRatingIFrame">
    <input name="rating" id="rating" type="hidden">
    <input name="itemId" id="itemId" type="hidden">
<iframe style="display: none; width: 0px; height: 0px;" id="setRatingIFrame" name="setRatingIFrame"></iframe>