problem with my user control with javascript

T

ThunderMusic

Hi,
Maybe I'm not in the good forum, but I try anyway.

I have the following code:

<script language="javascript">
function setRating(ImagePrefixId, Rating, divID) {
for (var cpt=10; cpt>0; cpt--) {
var img = document.getElementById(ImagePrefixId+cpt);
if (img) {
if (cpt<=Math.floor(Rating)){
img.cssClass='imgRatingGold';}
else if (Rating == (cpt-0.5)){
img.cssClass='imgRating50pct';}
else{
img.cssClass='imgRatingGrey';}
}
}
}
</script>

and here's an exemple of a used cssClass :

div.imgRatingGrey
{
position: relative;
width: 20px;
height: 18px;
background-image: url("/Site/images/greystar.gif");
}

When I try them individually, it works fine, but when the script tries to
change them, it does not work. It goes in the ifs (I tried with some
alert(cssClass) and got the good values), but no change is done in the page
display... so I was wondering if someone sees any error...

thanks

ThunderMusic
 
T

ThunderMusic

I solved my problem, the property is not cssClass it's className... so now
it works
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top