How can a javascript function from an external .js file be called with Actionscript?

I’ve tried using this:

getURL(“javascript:getHost(‘messages.aspx’)”, “_self”);

but the button i attached the actionscript to won’t respond. when it’s clicked, nothing happens. the getHost() function on the .js file (which is linked to the container page of the swf) goes like this:

function getHost(goto){

var host = location.protocol + “//” + location.host + “/”;

window.location = host + goto;

}

now i’m not so sure where the error lay. i could be wrong with the javascript (location.protocol usage?)

thanks for the help.