Toolbox Javascript + Multiple functions

I understand how to use the toolbox javascript plugin but I don’t understand how its possible to use it with code that includes more than one function.

see here for the code I’m trying to replicate:

If it cant be done via the toolbox plugin then how can I pass a database entry to this code (in header or external file) and then save to database/show on page

You can create a ‘run javascript’ action in your button clicked workflow.
In the javascript action, paste in all the JS from the JSfiddle example you’re using, and right at the end add this line:

Also make sure that you have the requisite HTML set up.

Create an HTML element and in the HTML contents of it, put in the HTML contents from the JSfiddle example - except for the line that defines the button (<button ......> ... </button>)

That should do it!