My experience with similar situation is that, if there is any error [Syntax] in the javascript function, the CE will not associate the function with the custom button and will give some message [Invalid Command] or something if we click the custom button continuously