The second uses JavaScript from a function already pre-loaded. The function can also be loaded in an external JavaScript file.