To make a button run this function, you'll need to run this function on mouse click for the button. So select the button, run a mouse click action, then select 'New Function' and paste this:
The 'onclick' text in the Anchor link just means that function following it should be run onclick. Using Hype's built in click function does the same thing and lets you assign this to elements.
Hope that helps!