well that's basically a javascript and not perl question. however, javascript already handles DOM manipulation quite well and you can set timer events to click button or whatever. in other words whilst in server side languages (liek perl) you're dealing with the html document, in javascript you interact directly with the browser document object model of the document and everything else that represents the browser/client environment. it's much easier if you use a library such as jquery. anyway, you're going to run into the problem of same origin policy for your javascript code, and you'll need to read up on this problem and potential workarounds. it's not trivial to work around the same origin restriction, just to let you know.
the hardest line to type correctly is: stty erase ^H