There are three solutions to this that I can think of. The first, injecting javascript from the server with ClientID as Dave suggests, works but gets really messy really fast. I did this for a while but that kind of tight-coupling of server-side and client-side causes problems.
The second is to provide another way to identify the entities, such as a css class. This is better than the first option, but leaves you with a lot of extraneous class definitions you have to keep straight.
The solution I prefer is to use a javascript framework like jQuery that has a selector engine. That way, you can get around the UniqueID garbage through some clever selection and DOM traversal.
Lets say you have a control named myControl. ASP.Net will generate a huge namespace before that so there aren't any id collisions when it renders. But you can select every myControl by doing $('[id$=myControl]') which selects every object with an id that ends with myControl. There are probably analogous ways of doing this in other frameworks, but I'm not familiar enough with them to give an example.