You could use a class selector. jquery might greatly simplify your life here. So you could apply a special class to the control:
and in your external javascript file once the DOM is ready you could reference the button using a class selector:
$(function() {
var fooButton = $('.foo');
});