Use Case - There is Javascript execute button on Account page layout named 'Update Account' -
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")}
//JSsript code which updates account based on some logic
...
..
//40 or 50 lines of Code
Problem with above button is it loads all this Javascript on every account pageview and kindof slows down each page view. what if we have 2 or more buttons then again its more time to load. Is there any way we can store Javascript in static resources and then load it only when user clicks button and then execute it ?
Note: I already know that you can Create Apex Webservice method and then call it from JS but wanted to check if there is any alternate way to do this.