home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOKAN 55
/
DOKAN55.ISO
/
Extra
/
MPSetup.exe
/
1033
/
RCDATA
/
CABINET
/
wmploc.DLL
/
HTML
/
RATING.HTC
< prev
next >
Wrap
Text File
|
2002-12-14
|
2KB
|
86 lines
<PUBLIC:COMPONENT lightWeight=true>
<PUBLIC:EVENT name="onRatingChange" ID=change>
<PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="mouseout()" />
<PUBLIC:ATTACH EVENT="onmousemove" ONEVENT="mousemove()" />
<PUBLIC:ATTACH EVENT="onmouseup" ONEVENT="clickIt()" />
<PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="start()" />
<PUBLIC:PROPERTY NAME="emptyImage" />
<PUBLIC:PROPERTY NAME="fullImage" />
<PUBLIC:PROPERTY NAME="rating" PUT='setRating' GET='getRating' />
<PUBLIC:PROPERTY NAME="allowChange" />
<SCRIPT LANGUAGE="JScript">
var iRating = '0', iMaxRating = 5, fInit = false;
function start()
{
init();
fInit = true;
draw(getRating());
}
function init()
{
var i, str = '';
for (i = 0; i < iMaxRating; i++)
str += '<IMG align=absmiddle id=' + uniqueID + '-' + i + ' src="' + emptyImage + '" rating=' + i + ' border=0>';
element.innerHTML = str;
}
function draw(iR)
{
var i, iID = 0;
if (!fInit) return;
// Full stars
for (i = 0; i < iR; i++, iID++)
element.document.all(uniqueID + '-' + iID).src = fullImage;
// Empty stars
for (i = iR; i < iMaxRating; i++, iID++)
element.document.all(uniqueID + '-' + iID).src = emptyImage;
}
function calcRating()
{
var iTempRating = 0, src;
src = event.srcElement;
// Calculate the temp rating based on where the event is fired
iTempRating = parseInt(src.rating) + 1;
return iTempRating;
}
function getRating()
{
var iR = parseInt(iRating);
if (isNaN(iR)) iR = 0;
return iR;
}
function setRating(iR) { iRating = iR; draw(getRating()); }
function mouseout() { if (allowChange == '1') draw(getRating()); }
function mousemove() { if (allowChange == '1') draw(calcRating()); }
function clickIt()
{
if (allowChange == '1')
{
setRating(calcRating());
var e = createEventObject();
e.rating = iRating;
change.fire(e);
}
}
</SCRIPT>
</PUBLIC:COMPONENT>