Okay thanks Fang!
but is there an alternative? if I use window.onload it tells me that my line
var rating = getElementById("ratingField");
expects an object, I presume because it can't find ratingField because it hasn't been loaded.
So what is the new technique of running scripts when the page has loaded?