Javascript in Alfresco runs inside the server. The Javascript environment has access to any Java objects that have been made available to it. You can consult the Javascript API documentation on the wiki to see how to set that up.
You would need a Java class that provides access to an ActiveXObject.