Hi list!
I wrote a little script for a star-rating-thing which looks like:

function rate_dvd(id, score)
{
        new Ajax.Request('/dvd/' + id + '/rate/' + score, {
                method:'get',
                requestHeaders: {Accept: 'application/json'},
                onSuccess: function(transport){
                    var json = transport.responseText.evalJSON(true);
                    var new_score = json.new_score;
                    var new_width = new_score * 25;
                    var ul = document.getElementById(id);               
                    var current_rating = 
ul.getElementsByClassName('current-rating')[0];
                
                    current_rating.setStyle({
                            width: new_width + 'px'
                    });
                }
        });
}

The html looks something like:

<ul class="star-rating" id="2">
        <li class="current-rating" style="width: 0.0px;">&nbsp;</li>
        ....                    
</ul>
<ul class="star-rating" id="3">
        <li class="current-rating" style="width: 0.0px;">&nbsp;</li>
        ....                    
</ul>

As you can see above, I just want to replace the width of the li element.
But this script doesn't work in IE (which is not that bad, but.. maybe
it's a little thing I've overseen because I never wrote JS before.)

So, maybe someone of you see what I've done wrong?

Thank you
Kai

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to