This is similar to a question posted just now. Are you using WWW::Mechanize or some module that uses an actual browser (like Win32::IE::Mechanize or Mozilla::Mechanize)?
You can click on links, but if you are using Mech, you won't be able to run the javascript. If you know enough javascript you could probably re-write the function into Perl, otherwise use a Mech that has a browser backend.